A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/8444 below:

Indexing Series with DataFrame should throw an exception · Issue #8444 · pandas-dev/pandas · GitHub

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4