pythonpandasdataframevaex

vaex - create a dataframe from a list of lists


In Vaex's docs, I cannot find a way to create a dataframe from a list of lists.

In pandas I would simply do pd.DataFrame([['A',1,3], ['B',2,4]]). How can this be done in Vaex?


Solution

  • There is no method to read list of lists in vaex, however, there is vaex.from_arrays() and it works like this:

    vaex.from_arrays(column_name_1=list_of_values_1, column_name_2=list_of_values_2)
    

    If you consider different python data structures, you may want to look at vaex.from_dict() or vaex.from_items()

    Since you already have the data in memory, you can use pd.DataFrame(list_of_lists) and then load it into vaex:

    vaex.from_pandas(pd.DataFrame(list_of_lists))
    

    You may want to del the list of lists data afterwards, to free up memory.