Closed Kei-kamo closed 1 year ago
I could solve this error by creating new conda emvironment.
I could solve this error by creating new conda emvironment.
Hi, guys! I have a same problem with you. so, how did you solve this error? are you install ipykernel in pip? or are you install jupyter in pip?
I used Python for sagemaker-distribution when I had this problem. So, I created a new conda environment and installed Jupyterlab in this environment in conda. Then, I installed wot in this environment in conda, and it worked. I didn't use ipykernel.
Thank you for your great tool.
I tried to visualize trajectory with the tutorial data, I got this error message.
Visualize trajectories
trajectory_dropdown = widgets.Dropdown( options=trajectory_ds.var.index, description='Trajectory:' )
def update_trajectory_vis(name): figure = plt.figure(figsize=(10, 10)) plt.axis('off') plt.tight_layout() plt.title(name) plt.scatter(coord_df['x'], coord_df['y'], c='#f0f0f0', s=4, marker=',', edgecolors='none', alpha=0.8) binned_df = trajectory_ds.obs.copy() binned_df['values'] = trajectory_ds[:, name].X binned_df = binned_df.groupby(['x', 'y'], as_index=False).sum() plt.scatter(binned_df['x'], binned_df['y'], c=binned_df['values'], s=6, marker=',', edgecolors='none', vmax=binned_df['values'].quantile(0.975)) plt.colorbar().ax.set_title('Trajectory')
widgets.interact(update_trajectory_vis, name=trajectory_dropdown)
ValueError Traceback (most recent call last) ~/.conda/envs/default/lib/python3.9/site-packages/ipywidgets/widgets/interaction.py in update(self, *args) 255 value = widget.get_interact_value() 256 self.kwargs[widget._kwarg] = value --> 257 self.result = self.f(**self.kwargs) 258 show_inline_matplotlib_plots() 259 if self.auto_display and self.result is not None:
/tmp/ipykernel_141/1734779123.py in update_trajectory_vis(name) 13 s=4, marker=',', edgecolors='none', alpha=0.8) 14 binned_df = trajectory_ds.obs.copy() ---> 15 binned_df['values'] = trajectory_ds[:, name].X 16 binned_df = binned_df.groupby(['x', 'y'], as_index=False).sum() 17 plt.scatter(binned_df['x'], binned_df['y'], c=binned_df['values'],
~/.conda/envs/default/lib/python3.9/site-packages/pandas/core/frame.py in setitem(self, key, value) 3976 else: 3977 # set column -> 3978 self._set_item(key, value) 3979 3980 def _setitem_slice(self, key: slice, value):
~/.conda/envs/default/lib/python3.9/site-packages/pandas/core/frame.py in _set_item(self, key, value) 4170 ensure homogeneity. 4171 """ -> 4172 value = self._sanitize_column(value) 4173 4174 if (
~/.conda/envs/default/lib/python3.9/site-packages/pandas/core/frame.py in _sanitize_column(self, value) 4907 return _reindex_for_setitem(value, self.index) 4908 elif is_dict_like(value): -> 4909 return _reindex_for_setitem(Series(value), self.index) 4910 4911 if is_list_like(value):
~/.conda/envs/default/lib/python3.9/site-packages/pandas/core/series.py in init(self, data, index, dtype, name, copy, fastpath) 468 data = data.copy() 469 else: --> 470 data = sanitize_array(data, index, dtype, copy) 471 472 manager = get_option("mode.data_manager")
~/.conda/envs/default/lib/python3.9/site-packages/pandas/core/construction.py in sanitize_array(data, index, dtype, copy, raise_cast_failure, allow_2d) 645 subarr = maybe_infer_to_datetimelike(subarr) 646 --> 647 subarr = _sanitize_ndim(subarr, data, dtype, index, allow_2d=allow_2d) 648 649 if isinstance(subarr, np.ndarray):
~/.conda/envs/default/lib/python3.9/site-packages/pandas/core/construction.py in _sanitize_ndim(result, data, dtype, index, allow_2d) 696 if allow_2d: 697 return result --> 698 raise ValueError("Data must be 1-dimensional") 699 if is_object_dtype(dtype) and isinstance(dtype, ExtensionDtype): 700 # i.e. PandasDtype("O")
ValueError: Data must be 1-dimensional <function main.update_trajectory_vis(name)>
Which data must be 1-dimensional ? I was just trying to reproduce trajectory with tutorial data, so I'm confused.