-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Error while trying to run the appended script #114
Comments
The error message says:
Have you tried that? |
@nschloe Thank you for the response. The script above works fine after setting the import numpy as np
import pandas as pd
import perfplot
import math
# arr = np.random.randint(1, 101, 1000)
# df = pd.DataFrame()
# df['r'] = arr
def create_random_array(x):
arr = np.random.randint(1, 10000, x)
return arr
def create_random_column(x):
arr = create_random_array(x)
df = pd.DataFrame()
df['r'] = arr
return df['r']
dicti = {}
for i in range(1, 100):
dicti[i] = i
def lets_map(x):
return create_random_column(x).map(dicti)
def lets_take(x):
arr = create_random_array(x)
print(arr)
return arr.take(list(dicti.keys()))
perfplot.show(
setup=np.random.randint,
n_range=[2 ** k for k in range(20)],
kernels=[lets_take, lets_map],
xlabel="len(x)",
equality_check= None
) And now, the program terminates with this, []
Overall ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:--
Kernels ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:--
Traceback (most recent call last):
File "test_perf.py", line 34, in <module>
perfplot.show(
File "/home/gaganaryan/anaconda3/envs/radis/lib/python3.8/site-packages/perfplot/_main.py", line 504, in show
out = bench(*args, **kwargs)
File "/home/gaganaryan/anaconda3/envs/radis/lib/python3.8/site-packages/perfplot/_main.py", line 465, in bench
timings_s[i] = next(b)
File "/home/gaganaryan/anaconda3/envs/radis/lib/python3.8/site-packages/perfplot/_main.py", line 215, in __next__
val = kernel(data)
File "test_perf.py", line 32, in lets_take
return arr.take(list(dicti.keys()))
IndexError: cannot do a non-empty take from an empty axes. Any ideas of how this can be resolved? |
Is |
I want to have a comparison with varying lengths of arrays and column and hence chose that setup. You think some other setup would be more relevant ? |
I don't know what you're trying to do exactly, but note that with np.random.randint(n) in each step, so a random number between |
I am trying to compare the performance of np.ndarray.take as compared to pandas.Series.map below. But I am facing errors while running this and am unable to makeout what is going wrong.
Script
Error Message
Perfplot looks like a good tool for me to benchmark stuff for my projects. Would greatly appreciate any help in working out with this. Thanks :)
The text was updated successfully, but these errors were encountered: