Skip to content

df.iterrows() constructs Series instead of its proper subclass #13977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kernc opened this issue Aug 12, 2016 · 0 comments
Closed

df.iterrows() constructs Series instead of its proper subclass #13977

kernc opened this issue Aug 12, 2016 · 0 comments
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Milestone

Comments

@kernc
Copy link
Contributor

kernc commented Aug 12, 2016

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).

@jreback jreback added Bug Dtype Conversions Unexpected or buggy dtype conversions labels Aug 13, 2016
@jreback jreback added this to the 0.19.0 milestone Aug 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants