miscset.tables.list_to_df

miscset.tables.list_to_df(lol, colnames=None, transpose=True)[source]

Convert a list of list to a pandas DataFrame.

Parameters
  • lol (list of lists) – 2-dimensional list array to parse to a DataFrame. Data is arranged row-wise, see argument transpose.

  • colnames (list) – Column names to set. If given None, create pseudo names with [col1, col2, …, coli, …, coln] notation.

  • transpose (bool) – Import data column-wise.

Returns

pandas.DataFrame

Example code:

import miscset
print(miscset.tables.list_to_df([[1,2,3], ["a","b","c"]]))

Result:

col1 col2
0    1    a
1    2    b
2    3    c