For a new
In : import pandas as pd dfo = pd.DataFrame() ...: dfo['filename'] = 'file1.csv'
What are its columns?
In : dfo.columns Out: Index(['filename'], dtype='object')
That looks OK. What about the “row” that was added (with value
In : len(dfo) Out: 0
Not so good.. So what happened here? How should that column value be added: can it be done similarly to the original attempt or do we need separate commands?
My motivation is that the set of columns is determined dynamically and it fits this particular use case better to do one at a time instead of in bulk like I typically do.
The input should be a list
import pandas as pd df = pd.DataFrame() df['filename'] = ['hhh.xlsx']
and the dataframe will be
Is this what you want?