Reputation: 11
I am using Polars to unpivot a dataframe, convert Pandas, then plot with altair. It is a large dataframe, but I have implemented the techniques present here and here to manage the large amount of data for Altair.
However, the output of the Altair plot is empty (shows axis and figure but no data). I suspect that Altair is having trouble reading the JSON data saved to local disk, but at a loss as to why.
Can anyone please point me in the right direction?
For example with fabricated Pandas dataframe (edited per Nick's request):
import os
from toolz.curried import pipe
def json_dir(data, data_dir='/path/to/altairdata'):
os.makedirs(data_dir, exist_ok=True)
return pipe(data, alt.to_json(filename=data_dir + '/{prefix}-{hash}.{extension}') )
alt.data_transformers.register('json_dir', json_dir)
alt.data_transformers.enable('json_dir')
alt.data_transformers.disable_max_rows()
alt.Chart(pd.DataFrame({'A': [1,2,3], 'B': [5,8,10]})).mark_point().encode(x='A', y='B')
Tried to plot a pandas dataframe with Altair boxplot
, but Altair boxplot
is empty.
Upvotes: 0
Views: 286