Skip to content

BUG: DataFrame.from_records doesn't raise proper error message when Series passed #40870

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
wants to merge 2 commits into from
Closed

Conversation

hasan-yaman
Copy link
Contributor

@phofl
Copy link
Member

phofl commented Apr 10, 2021

Since this was tested, should we deprecate these cases first?

@mzeitlin11
Copy link
Member

mzeitlin11 commented Apr 10, 2021

The docs include sequence of tuples or dicts as an input option, so continuing to support that seems fine (or at least should be deprecated). So those tests probably shouldn't be deleted.

@hasan-yaman
Copy link
Contributor Author

Passing series will give an error and according to docs Series are not supported (#40429 ).
With the PR, pandas will continue to support sequence of tuples or dicts and it will give more appropriate error message when Series passed.

@hasan-yaman
Copy link
Contributor Author

hasan-yaman commented Apr 12, 2021

By the way, any suggestion to fix failing test(I think related to mypy.)?

@jreback jreback added the Constructors Series/DataFrame/Index/pd.array Constructors label Apr 13, 2021
@datapythonista
Copy link
Member

Thanks for the contribution @hasan-yaman

I think it makes more sense if DataFrame.from_records(data=Series([1, 2, 3])) just returns data.to_frame(). The code here looks cumbersome, and likely to cause problems in the future. @jreback what do you think?

One question @hasan-yaman, why are you removing tests? I guess I'm missing something, but existing tests should be kept, and a new one passing a Series should be added. Removing or editing tests while changing existing code is dangerous.

@simonjayhawkins simonjayhawkins added the Error Reporting Incorrect or improved errors from pandas label May 25, 2021
@github-actions
Copy link
Contributor

This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Jun 25, 2021
@simonjayhawkins
Copy link
Member

@hasan-yaman can you address @datapythonista comments

@mroeschke
Copy link
Member

Thanks for the PR, but it appears to have gone stale and needs follow up from the other reviewers. Closing, but happy to open if you're interested on continuing.

@mroeschke mroeschke closed this Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Constructors Series/DataFrame/Index/pd.array Constructors Error Reporting Incorrect or improved errors from pandas Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataFrame.from_records fails when the argument is Series with non-default index
7 participants