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

PREF: Speed up to_set #585

Merged
merged 4 commits into from Jun 25, 2022
Merged

PREF: Speed up to_set #585

merged 4 commits into from Jun 25, 2022

Conversation

Zeroto521
Copy link
Owner

@Zeroto521 Zeroto521 commented Jun 25, 2022

test via timeit command

s = loop ranges set(s) set(s.values) set(s.to_numpy()) set(s.to_list()) set(s.unique())
pd.Series(range(10)) 7e4 ~ 7e6 2.36 µs ± 70.2 ns 2.42 µs ± 123 ns 3.45 µs ± 82.7 ns 999 ns ± 18.2 ns 27.4 µs ± 771 ns
pd.Series(list(range(10))*1e4) 7e2 ~ 7e3 8.33 ms ± 665 µs 6.46 ms ± 198 µs 6.75 ms ± 500 µs 1.75 ms ± 23.7 µs 952 µs ± 8.71 µs
pd.Series(range(int(1e5))) 7e2 13.7 ms ± 469 µs 9.95 ms ± 472 µs 9.77 ms ± 649 µs 6.3 ms ± 328 µs 12.7 ms ± 820 µs

@codecov
Copy link

codecov bot commented Jun 25, 2022

Codecov Report

Merging #585 (98d8701) into main (055b3f5) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #585   +/-   ##
=======================================
  Coverage   99.55%   99.55%           
=======================================
  Files          75       75           
  Lines         903      903           
  Branches       99       99           
=======================================
  Hits          899      899           
  Misses          1        1           
  Partials        3        3           
Impacted Files Coverage Δ
dtoolkit/accessor/index/to_set.py 100.00% <ø> (ø)
dtoolkit/accessor/series/to_set.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 055b3f5...98d8701. Read the comment docs.

index.unqie has a level argument
@Zeroto521 Zeroto521 enabled auto-merge (squash) June 25, 2022 05:59
@Zeroto521 Zeroto521 merged commit 20aa015 into main Jun 25, 2022
@Zeroto521 Zeroto521 deleted the to_set/performance branch June 25, 2022 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant