I want to convert a table, represented as a list of lists, into a Pandas DataFrame
. As an extremely simplified example:
a = [[\'a\', \'1.2\', \'
How about creating two dataframes, each with different data types for their columns, and then appending them together?
d1 = pd.DataFrame(columns=[ 'float_column' ], dtype=float)
d1 = d1.append(pd.DataFrame(columns=[ 'string_column' ], dtype=str))
Results
In[8}: d1.dtypes
Out[8]:
float_column float64
string_column object
dtype: object
After the dataframe is created, you can populate it with floating point variables in the 1st column, and strings (or any data type you desire) in the 2nd column.