Skip to content

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
@mroeschke mroeschke added the Performance Memory or execution speed performance label Aug 30, 2023
else df[col].to_numpy().tolist(),
)
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
@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