Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

creating data frame in python with for loop

df = pd.DataFrame(columns=["A", "B"])

for i in range(2):
    this_column = df.columns[i]
    df[this_column] = [i, i+1]

print(df)

#OUTPUT
#  A B
#0 0 1
#1 1 2
Source by www.kite.com #
 
PREVIOUS NEXT
Tagged: #creating #data #frame #python #loop
ADD COMMENT
Topic
Name
5+4 =