Using: Python 2.7 and Pandas 0.11.0 on Mac OSX Lion
I'm trying to create an empty DataFrame
and then populate it from another dataframe, based on a for loop
.
I have found that when I construct the DataFrame
and then use the for loop
as follows:
data = pd.DataFrame()
for item in cols_to_keep:
if item not in dummies:
data = data.join(df[item])
Results in an empty DataFrame
, but with the headers of the appropriate columns to be added from the other DataFrame
.