Hi
When using the seaborn function barplot() i encountered this error!
from what i could find out it seems that there is a compatibility issue with numpy and seaborn library installed within the getpod’s vertualenv located in the Page View Time Series Visualizer project which is a part of the data analysis with python curriculum .
some debugging later i found that seborn uses the deprecated dtype=np.floatin two instances related to the foretold function, when manually changed to dtype=‘float’ everything runs fine!, so am i in the wrong here as in that’s the way it is purposefully setup or what?!
THX
full error traceback:
Traceback (most recent call last):
File “main.py”, line 7, in
time_series_visualizer.draw_bar_plot()
File “/workspace/boilerplate-page-view-time-series-visualizer/time_series_visualizer.py”, line 34, in draw_bar_plot
sns.barplot(
File “/workspace/.pyenv_mirror/user/current/lib/python3.8/site-packages/seaborn/categorical.py”, line 3146, in barplot
plotter = _BarPlotter(x, y, hue, data, order, hue_order,
File “/workspace/.pyenv_mirror/user/current/lib/python3.8/site-packages/seaborn/categorical.py”, line 1606, in init
self.establish_variables(x, y, hue, data, orient,
File “/workspace/.pyenv_mirror/user/current/lib/python3.8/site-packages/seaborn/categorical.py”, line 158, in establish_variables
orient = self.infer_orient(x, y, orient)
File “/workspace/.pyenv_mirror/user/current/lib/python3.8/site-packages/seaborn/categorical.py”, line 359, in infer_orient
elif is_not_numeric(y):
File “/workspace/.pyenv_mirror/user/current/lib/python3.8/site-packages/seaborn/categorical.py”, line 339, in is_not_numeric
np.asarray(s, dtype=np.float)
File “/workspace/.pyenv_mirror/user/current/lib/python3.8/site-packages/numpy/init.py”, line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module ‘numpy’ has no attribute ‘float’.
np.float
was a deprecated alias for the builtin float
. To avoid this error in existing code, use float
by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64
here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
NumPy 1.20.0 Release Notes — NumPy v2.1.dev0 Manual