You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across this today when being a little bit careless when using a boolean array to index into a Series. The result was not what I expected which turned out to be because I was using a boolean index in a DataFrame to index a Series. Either we should make this work or throw an error that you cannot index a Series with a DataFrame.
import pandas as pd
series = pd.Series(10, index=range(10))
df = pd.DataFrame(range(10), index=range(10))
series[df > 5]
Out[9]:
0 10
dtype: int64
# What is really meant is this:
series[df[0] > 5]
Out[11]:
6 10
7 10
8 10
9 10
dtype: int64
This is on 0.14.1
The text was updated successfully, but these errors were encountered:
rockg
changed the title
Indexing Series with Dataframe should throw an exception
Indexing Series with DataFrame should throw an exception
Oct 2, 2014
I came across this today when being a little bit careless when using a boolean array to index into a Series. The result was not what I expected which turned out to be because I was using a boolean index in a DataFrame to index a Series. Either we should make this work or throw an error that you cannot index a Series with a DataFrame.
This is on 0.14.1
The text was updated successfully, but these errors were encountered: