【发布时间】:2019-03-11 22:52:45
【问题描述】:
我想创建一个每列有多个标题的 Pandas 数据框,并用循环中的数据逐行填充数据框。我以前创建过数据框,但这对于我真正想做的事情来说似乎非常复杂,我不知道从哪里开始。
例子:
step = list(range(1,5))
for i in step:
time = -2
for j in range(0,5): # Time goes from -2 to 2
one = time*0.5
two = time*0.4
score = one + two
# Code populate dataframe with column time for one and two sub columns,
# and the score for the score column
time += 1
print("step %s " % i)
【问题讨论】:
标签: python pandas dataframe indexing