Skip to content

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

Open
@kevalshah90

Description

Environment

  • Operating System: MacOS Monterey
  • Python Version: 3.9
  • How did you install Qgrid: pip and conda, v1.3.1
  • Python packages: $ pip freeze or $ conda list (please include qgrid, notebook, and jupyterlab versions)
  • Jupyter lab packages (if applicable): $ jupyter labextension list

Description of Issue

Issue rendering the dataframe. Exception: AttributeError: 'DataFrame' object has no attribute 'map'

  • What did you expect to happen?

Render dataframe

  • What happened instead?
/Applications/Anaconda/anaconda3/lib/python3.9/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,

/Applications/Anaconda/anaconda3/lib/python3.9/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):

/Applications/Anaconda/anaconda3/lib/python3.9/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 

/Applications/Anaconda/anaconda3/lib/python3.9/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)

/Applications/Anaconda/anaconda3/lib/python3.9/site-packages/pandas/core/generic.py in __getattr__(self, name)
   5485         ):
   5486             return self[name]
-> 5487         return object.__getattribute__(self, name)
   5488 
   5489     def __setattr__(self, name: str, value) -> None:

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

Reproduction Steps -

It happens in my environment with this particular DataFrame. Other DataFrames are rendered fine, no issue with them.

  1. Unable to share the entire DataFrame. However, I have confirmed that the object is of type: pandas.core.frame.DataFrame

...

What steps have you taken to resolve this already?

...

Anything else?

...

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