question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

df.interactive() fails on a pandas DataFrame that has 'interface' in df.columns

See original GitHub issue

ALL software version info

Description of expected behavior and the observed behavior

Expected: executing interactive() on a pandas.DataFrame should return an interactive pandas DataFrame that I can use with widgets. This should be true for any column name specified in the DataFrame.

Observed: interactive() fails on a pandas.DataFrame object that includes a column named interface.

Complete, minimal, self-contained example code that reproduces the issue

import hvplot.pandas
pd.DataFrame([1,2,3], columns=['interface']).interactive()

Stack traceback and/or browser JavaScript console output

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-11-dff52aeb506d> in <module>
      1 import hvplot.pandas
----> 2 pd.DataFrame([1,2,3], columns=['interface']).interactive()

~\Projects\holoviz_tutorial\envs\default\lib\site-packages\hvplot\pandas.py in <lambda>(self)
     17     setattr(pd.Series, name, plot_prop)
     18 
---> 19     _patch_interactive = lambda self: Interactive(self)
     20     _patch_interactive.__doc__ = Interactive.__call__.__doc__
     21     interactive_prop = property(_patch_interactive)

~\Projects\holoviz_tutorial\envs\default\lib\site-packages\hvplot\interactive.py in __init__(self, obj, transform, plot, depth, loc, center, dmap, inherit_kwargs, max_rows, **kwargs)
     83         self._max_rows = max_rows
     84         self._kwargs = kwargs
---> 85         ds = hv.Dataset(self._obj)
     86         self._current = self._transform.apply(ds, keep_index=True, compute=False)
     87         self._init = True

~\Projects\holoviz_tutorial\envs\default\lib\site-packages\holoviews\core\data\__init__.py in __init__(self, data, kdims, vdims, **kwargs)
    339 
    340         validate_vdims = kwargs.pop('_validate_vdims', True)
--> 341         initialized = Interface.initialize(type(self), data, kdims, vdims,
    342                                            datatype=kwargs.get('datatype'))
    343         (data, self.interface, dims, extra_kws) = initialized

~\Projects\holoviz_tutorial\envs\default\lib\site-packages\holoviews\core\data\interface.py in initialize(cls, eltype, data, kdims, vdims, datatype)
    206 
    207         # Process Element data
--> 208         if (hasattr(data, 'interface') and issubclass(data.interface, Interface)):
    209             if datatype is None:
    210                 datatype = [dt for dt in data.datatype if dt in eltype.datatype]

TypeError: issubclass() arg 1 must be a class

Screenshots or screencasts of the bug in action

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
geronimoscommented, Jul 29, 2021

I implemented a fix in holoviews/core/data/interface and also added a test that succeeds only after the fix. However, I do not have access rights to push the created fix-core-data-interface branch to holoviews. How can I push the fix to origin?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python / Pandas - GUI for viewing a DataFrame or Matrix
Basically a window that has a read-only spreadsheet like view into the data. I can expand columns, page up and down through long...
Read more >
Using PandasGUI to analyze Pandas DataFrames on ...
This article shows how to use PandasGUI tool for basic data analysis with the simple GUI interface. The demo application uses Corona Virus ......
Read more >
Python Pandas Select Columns Tutorial - DataCamp
Use Python Pandas and select columns from DataFrames. Follow our tutorial with code examples and learn different ways to select your data today!...
Read more >
Solved: Dataframe output Key Error - Alteryx Community
Pandas KeyError occurs when we try to access some column/row label in our DataFrame that doesn't exist. Usually, this error occurs when you ......
Read more >
Indexing and Selecting Data — pandas 0.13.1 documentation
You may access an index on a Series, column on a DataFrame, and a item on a ... In [12]: sa = Series([1,2,3],index=list('abc'))...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found