Skip to content

Feature Request: pandas.DataFrame.from_records(New "Include" parameter) #15319

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
alexlenail opened this issue Feb 6, 2017 · 3 comments
Closed
Labels
Enhancement Reshaping Concat, Merge/Join, Stack/Unstack, Explode

Comments

@alexlenail
Copy link
Contributor

alexlenail commented Feb 6, 2017

Pandas Dataframe.from_records has an Exclude parameter:

exclude : sequence, default None
Columns or fields to exclude

The logic for column exclusion can be found here.

Since for my specific use case, I'd like to exclude most of my columns, and would rather just specify which columns to include, I'd love to also see an Include parameter here.

Arbitrarily, if a field were both Included and Excluded it could be excluded (or throw an error).

@jreback
Copy link
Contributor

jreback commented Feb 6, 2017

I suppose that is reasonable. Can you do a pull-request for this this?

we have similar logic in .select_dtypes, so could follow that model.

@jreback jreback added Difficulty Novice Enhancement Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Feb 6, 2017
@jreback jreback added this to the Next Major Release milestone Feb 6, 2017
@alexlenail
Copy link
Contributor Author

@miahunsicker It may be the case that the "columns" parameter actually does this, which would be unintuitive. My tests seem to indicate that's what it's doing.

@jreback
Copy link
Contributor

jreback commented Feb 8, 2017

yeah, re-reading the description makes it clear that columns is esentially include, though it does also provides names. In theory if one were writing this again, we would use the terms names and usecols, like read_csv. But this ship has sailed.

I think what would be really useful here is to provide a set of examples that show the uses (in the doc-string).

up for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants