I\'m new to using pandas and am writing a script where I read in a dataframe and then do some computation on some of the columns.
Sometimes I will have the column called
If you were creating the dataframe from scratch, you could create the missing columns without a loop merely by passing the column names into the pd.DataFrame() call:
pd.DataFrame()
cols = ['column 1','column 2','column 3','column 4','column 5'] df = pd.DataFrame(list_or_dict, index=['a',], columns=cols)