Skip to content

AttributeError: 'DataFrame' object has no attribute 'map' when running qgrid.enable() #360

Open
@info-rchitect

Description

@info-rchitect

Environment

  • Operating System: Windows 10
  • Python Version: `$3.8.5
  • How did you install Qgrid: pip
  • Python packages: `$ qgrid==1.3.1, jupyter notebook 6.1.4

Description of Issue

Tried to enable qgrid by default for all dataframes in my Jupyter Notebook

Reproduction Steps

  1. qgrid.enable()
  2. my_dataframe

What steps have you taken to resolve this already?

None
...

Anything else?

Full stack error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Roaming\Python\Python38\site-packages\IPython\core\formatters.py in __call__(self, obj)
    911                 pass
    912             else:
--> 913                 printer(obj)
    914                 return True
    915             # Finally look for special method names

C:\ProgramData\Anaconda3\lib\site-packages\qgrid\grid.py in _display_as_qgrid(data)
    276 
    277 def _display_as_qgrid(data):
--> 278     display(show_grid(data))
    279 
    280 

C:\ProgramData\Anaconda3\lib\site-packages\qgrid\grid.py in show_grid(data_frame, show_toolbar, precision, grid_options, column_options, column_definitions, row_edit_callback)
    504 
    505     # create a visualization for the dataframe
--> 506     return QgridWidget(df=data_frame, precision=precision,
    507                        grid_options=grid_options,
    508                        column_options=column_options,

C:\ProgramData\Anaconda3\lib\site-packages\qgrid\grid.py in __init__(self, *args, **kwargs)
    625 
    626         if self.df is not None:
--> 627             self._update_df()
    628 
    629     def _grid_options_default(self):

C:\ProgramData\Anaconda3\lib\site-packages\qgrid\grid.py in _update_df(self)
    818         self._unfiltered_df = self._df.copy()
    819 
--> 820         self._update_table(update_columns=True, fire_data_change_event=False)
    821         self._ignore_df_changed = False
    822 

C:\ProgramData\Anaconda3\lib\site-packages\qgrid\grid.py in _update_table(self, update_columns, triggered_by, scroll_to_row, fire_data_change_event)
    909                 series_to_set = df[sort_column_name]
    910             else:
--> 911                 series_to_set = self._get_col_series_from_df(
    912                     col_name, df, level_vals=True
    913                 ).map(stringify)

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
   5137             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5138                 return self[name]
-> 5139             return object.__getattribute__(self, name)
   5140 
   5141     def __setattr__(self, name: str, value) -> None:

AttributeError: 'DataFrame' object has no attribute 'map'

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions