Created
September 28, 2022 19:35
-
-
Save Quetzalcohuatl/021a42f342ab5299cf8ed7672e547e28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/pandas-dev/pandas/issues/15389 | |
import pandas | |
import numpy | |
import resource | |
import sys | |
variant, nrows, ncols = sys.argv[1:4] | |
numpy.random.seed(0) | |
df = pandas.DataFrame(numpy.random.randn(int(nrows), int(ncols))) | |
if variant == '1': | |
df.sort_values(by=list(df.columns), inplace=True) | |
elif variant == '2': | |
order = numpy.lexsort( | |
[df[col].values for col in reversed(list(df.columns))]) | |
for col in list(df.columns): | |
df[col] = df[col].values[order] | |
usage = resource.getrusage(resource.RUSAGE_SELF) | |
print 'Time:', usage.ru_utime | |
print 'Memory:', usage.ru_maxrss | |
print 'Result hash:', hash(df.values.tobytes()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment