-
Notifications
You must be signed in to change notification settings - Fork 68
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
[QST] error 'ndarray' object has no attribute 'to_pandas' #561
Comments
Hi @hakim3189, can you please post the versions of cuxfilter, cudf and numpy you are using? |
herewith the version |
Hey @hakim3189, I was not able to reproduce the error on the latest stable release. Can you please give it a try on the version 23.12.* for cudf and cuxfilter? |
ok i will try to update cudf and cuxfilter first |
hey @AjayThorve , recently i already update my version. but somehow it still produce this error AttributeError Traceback (most recent call last) File ~/miniconda3/envs/rapids-23.12/lib/python3.10/site-packages/cuxfilter/dataframe.py:236, in DataFrame.dashboard(self, charts, sidebar, layout, theme, title, data_size_widget, warnings, layout_array) File ~/miniconda3/envs/rapids-23.12/lib/python3.10/site-packages/cuxfilter/dashboard.py:186, in DashBoard.init(self, charts, sidebar, dataframe, layout, theme, title, data_size_widget, show_warnings, layout_array) File ~/miniconda3/envs/rapids-23.12/lib/python3.10/site-packages/cuxfilter/charts/panel_widgets/plots.py:334, in MultiChoice.initiate_chart(self, dashboard_cls) File ~/miniconda3/envs/rapids-23.12/lib/python3.10/site-packages/cuxfilter/charts/panel_widgets/plots.py:347, in MultiChoice.calc_list_of_values(self, data) AttributeError: 'ndarray' object has no attribute 'to_pandas' |
Hey @hakim3189 this is a bit weird, can you get the following working in your enviroment? import cudf
df = cudf.DataFrame({"a":[1,23,3]}, dtype={"a":"int64"})
print(df['a'].unique().to_pandas().tolist()) the error that's raised refers to the above usage of cudf, which on my 23.12 enviroment, works fine. I would need more info into your data. Also I am assuming you are using this with |
hey @AjayThorve it produce this error in my environment AttributeError Traceback (most recent call last) AttributeError: 'ndarray' object has no attribute 'to_pandas' data is originally in pandas but then I convert to cu_df |
Hey @AjayThorve Finally I found why this happen at first herewith my Script : but after I rerun but without this line it work perfectly Thanks for your help |
Thats great @hakim3189. Yeah I think importing cudf after loading cudf.pandas might have cuased the issue. I'll make sure we make it clear on the usage with cudf.pandas in the documentation soon. Feel free to open up an issue if you face any in future. |
Hi All,
recently I have problem using widget in cuxfilter, my code always produce "AttributeError: 'ndarray' object has no attribute 'to_pandas'"
when using Multiselect & Dropdown but working perfectly when using range_slider. Need guidance why this problem happen and how to solve it.
AttributeError Traceback (most recent call last)
Cell In[131], line 1
----> 1 d1 = cux_df.dashboard([chart1, chart2],sidebar=[chart3,chart4],layout=cuxfilter.layouts.feature_and_base, theme=cuxfilter.themes.rapids_dark)
2 #[chart1, chart3, chart4], sidebar=[chart2], layout=cuxfilter.layouts.feature_and_double_base, title='Auto Accident Dataset'
File ~/miniconda3/envs/rapids-23.10/lib/python3.10/site-packages/cuxfilter/dataframe.py:236, in DataFrame.dashboard(self, charts, sidebar, layout, theme, title, data_size_widget, warnings, layout_array)
233 if notebook_assets.pn.config.js_files == {}:
234 notebook_assets.load_notebook_assets()
--> 236 return DashBoard(
237 charts=charts,
238 sidebar=sidebar,
239 dataframe=self,
240 layout=layout,
241 theme=theme,
242 title=title,
243 data_size_widget=data_size_widget,
244 show_warnings=warnings,
245 layout_array=layout_array,
246 )
File ~/miniconda3/envs/rapids-23.10/lib/python3.10/site-packages/cuxfilter/dashboard.py:186, in DashBoard.init(self, charts, sidebar, dataframe, layout, theme, title, data_size_widget, show_warnings, layout_array)
184 for chart in sidebar:
185 if chart.is_widget:
--> 186 chart.initiate_chart(self)
187 chart._initialized = True
188 self._sidebar[chart.name] = chart
File ~/miniconda3/envs/rapids-23.10/lib/python3.10/site-packages/cuxfilter/charts/panel_widgets/plots.py:334, in MultiChoice.initiate_chart(self, dashboard_cls)
328 self.min_value, self.max_value = get_min_max(
329 dashboard_cls._cuxfilter_df.data, self.x
330 )
331 self.source = dashboard_cls._cuxfilter_df.data[self.x].reset_index(
332 drop=True
333 )
--> 334 self.calc_list_of_values(dashboard_cls._cuxfilter_df.data)
335 self.generate_widget()
336 self.add_events(dashboard_cls)
File ~/miniconda3/envs/rapids-23.10/lib/python3.10/site-packages/cuxfilter/charts/panel_widgets/plots.py:347, in MultiChoice.calc_list_of_values(self, data)
344 if isinstance(data, dask_cudf.core.DataFrame):
345 self.list_of_values = self.list_of_values.compute()
--> 347 self.list_of_values = self.list_of_values.to_pandas().tolist()
349 if len(self.list_of_values) > 500:
350 print(
351 """It is not recommended to use a column with
352 so many different values for MultiChoice menu"""
353 )
AttributeError: 'ndarray' object has no attribute 'to_pandas'
chart3 = cuxfilter.charts.range_slider('RSRP_Status') --> working
chart3 = cuxfilter.charts.drop_down('RSRP_Status') --> not working
Herewith the dtypes
Tile Id int64
Date datetime64[ns]
Serving Cell Average RSRP (All) (dBm) float64
Serving Cell Average RSRQ (All) (dB) float64
Total MR Count int64
Longitude float64
Latitude float64
x float64
y float64
RSRP_Status int64
dtype: object
The text was updated successfully, but these errors were encountered: