我有一个Pandas专栏,
int total = 23;
int years = total / 12;
int months = total % 12;
我有一个值列表:[.45,.31,.543]
我想将这些值附加到上面的列中,这样最终结果将是:
Free-Throw Percentage
0 .371
1 .418
2 .389
3 .355
4 .386
5 .605
我该如何实现?
答案 0 :(得分:-1)
df.append(pd.DataFrame({'Free-Throw Percentage':[.45,.31,.543]}))
应该做的事
答案 1 :(得分:-1)
import pandas as pd
df_1 = pd.DataFrame(data=zip(np.random.randint(0, 20, 10), np.random.randint(0, 10, 10)), columns=['A', 'B'])
new_vals = [3, 4, 5]
df_1 = df_1.append(pd.DataFrame({'B': new_vals}), sort=False, ignore_index=True)
print(df_1)