Considering your dataframe has name df
. First make two series of zeros, one for state
and second for city
.
Note: I am just taking some initial values of your dataframe but it will work for any size of dataframe.
city = pd.Series(np.zeros(len(df)))
state = pd.Series(np.zeros(len(df)))
Now, make a dataframe from these two series like this,
df1 = pd.DataFrame()
df1['state_0'] = state.values
df1['city_0'] = city.values
df1
Ouput:
state_0 city_0
0 0.0 0.0
1 0.0 0.0
2 0.0 0.0
3 0.0 0.0
Then, make a second dataframe as your original,
df2 = df
df2
Output:
state city
0 0 0
1 13 9
2 118 2524
3 20 0
Now, just concatenate these two dataframes like this,
df = pd.concat([df1, df2], axis=1)
df
Output:
state_0 city_0 state city
0 0.0 0.0 0 0
1 0.0 0.0 13 9
2 0.0 0.0 118 2524
3 0.0 0.0 20 0