Skip to content

Add index param to to_dict like in to_json. #46398

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
pavelkomarov opened this issue Mar 16, 2022 · 2 comments · Fixed by #48429
Closed

Add index param to to_dict like in to_json. #46398

pavelkomarov opened this issue Mar 16, 2022 · 2 comments · Fixed by #48429
Assignees
Labels
API - Consistency Internal Consistency of API/Behavior Enhancement IO Data IO issues that don't fit into a more specific label

Comments

@pavelkomarov
Copy link

df.to_json(orient='split', index=False) is really nice. df.to_dict(orient='split') basically does the same thing, but I get a dictionary back instead of a string. For symmetry, I'd like to_dict to also have an index param, so I can keep from having to del dictionary['index'] to make them really similar.

@pavelkomarov pavelkomarov added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 16, 2022
@vruthik
Copy link

vruthik commented Mar 22, 2022

take

@rhshadrach
Copy link
Member

but I get a dictionary back instead of a string

I'm not sure I follow what the expectation is here. But in any case, I'm +1 in adding index for API consistency with other DataFrame.to_* methods.

@rhshadrach rhshadrach added IO Data IO issues that don't fit into a more specific label API - Consistency Internal Consistency of API/Behavior and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 28, 2022
@rhshadrach rhshadrach added this to the Contributions Welcome milestone Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Enhancement IO Data IO issues that don't fit into a more specific label
Projects
None yet
3 participants