Skip to content
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

#50990 Increase to_dict('list') performance #54824

Merged
merged 14 commits into from Sep 1, 2023
Merged

Conversation

taytzehao
Copy link
Contributor

@taytzehao taytzehao commented Aug 28, 2023

25.8±2ms 1.61±0.4ms 0.06 frame_methods.ToDict.time_to_dict_datetimelike('list')

@taytzehao taytzehao marked this pull request as ready for review August 29, 2023 17:49
@taytzehao taytzehao changed the title autoformat #50990 Increase to_dict('list') performance Aug 29, 2023
pandas/core/frame.py Outdated Show resolved Hide resolved
@mroeschke mroeschke added the Performance Memory or execution speed performance label Aug 30, 2023
)
for i, (k, v) in enumerate(df.items())
for i, col in enumerate(df.columns)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test where to_dict("list") is called on a DataFrame with duplicate column labels?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the catch, didin think about it

@mroeschke mroeschke added this to the 2.2 milestone Sep 1, 2023
@mroeschke mroeschke merged commit 18315c5 into pandas-dev:main Sep 1, 2023
38 checks passed
@mroeschke
Copy link
Member

Thanks @taytzehao

mroeschke pushed a commit to mroeschke/pandas that referenced this pull request Sep 11, 2023
* autoformat

* autoformat

* whatsnew

* reformat

* rm values

* to_numpy()

* to_numpy()

* rm newline

* .items

* unit test

* comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PERF: to_dict('list') method slow
2 participants