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/13977 below:

df.iterrows() constructs Series instead of its proper subclass · Issue #13977 · pandas-dev/pandas · GitHub

Code Sample, a copy-pastable example if possible
import pandas as pd
import numpy as np


class SubclassedSeries(pd.Series):
    pass


class SubclassedDataFrame(pd.DataFrame):
    _constructor_sliced = SubclassedSeries


df = SubclassedDataFrame(np.random.random((3, 2))
i, row = next(df.iterrows())

assert isinstance(row, SubclassedSeries)  # fails
Expected Output

row would be of proper overriden _constructor_sliced type (i.e. SubclassedSeries).


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