I am trying to load a dataframe(vaex) to dash datatable and getting following error.
Invalid argument data
passed into DataTable with ID "table".
Expected an array.
Was supplied type object
.
Tried the following, is it possible to load vaex dataframe to dash datatable like pandas dataframe.
import vaex
import dash
# import dash_table
from dash import dash_table
import pandas as pd
df = vaex.open('./customer_list_100.csv.hdf5')
app = dash.Dash(__name__)
app.layout = dash_table.DataTable(
id='table',
columns=[{"name": i, "id": i} for i in df.columns],
data=df.to_dict(),
)
if __name__ == '__main__':
app.run_server(debug=True)
Can anybody help me on this?
After looking at the vaex docs and testing, it looks like you need to use the code below to get the proper data orientation:
data = df.to_records()
vaex doesn't give you the option to specify an orient
arg like pandas, instead, you just use to_records()
.