SolaraS
Solara2y ago
rob-vh

What are the limitations/restrictions of solara.DataFrame()?

My application has a beefed-up class of DataFrames, with several methods added, and solara.DataFrame dies when I want to display it:

TypeError: <class 'main.MyFrame'> not supported

import pandas as pd
import solara

class MyFrame(pd.DataFrame):
@property
def _constructor(self):
'''result of a method is also a MyFrame'''
return MyFrame

def myFilter(self,a):
return self.filter(a)

std_frame = pd.DataFrame({'a':[1,2,3,4], 'b':[5,6,7,8]})
my_frame = MyFrame({'a':[5,6,7,8], 'b':[9,10,11,12]})

@solara.component
def detailsFrame(df,value=slice(None)):
print(df.shape)
return solara.DataFrame(df.loc[value])

@solara.component
def Page():
detailsFrame(my_frame)

So this works with:

detailsFrame(std_frame)
detailsFrame(pd.DataFrame(my_frame))

but not with detailsFrame(my_frame)

Are there more restrictions I should be aware of?
Was this page helpful?