0

Python pandas dataframe looping

import pandas as pd df2 = pd.DataFrame([]) for i in range(0,6): df1 = pd.DataFrame([[i,i+1]], columns=['a','b']) print(df2.append(df1)) Can anyone please let me that where am I making the mistake I want the output as dataframe a b 0 1 1 2 2 3 3 4 4 5 5 6 And it should be stored in the df2 dataframe

3rd Dec 2018, 3:14 PM
SANDEEP B
SANDEEP B - avatar
1 Odpowiedź
+ 1
import pandas as pd df2 =[] for i in range(6): df1 = [i, i+1] df2.append(df1) df2 = pd.DataFrame(df2, columns=['a','b']) print(df2)
5th Dec 2018, 6:44 AM
zemiak