空のDataFrameに1行ずつデータを追加[pandas]
サンプル
import pandas as pd
df = pd.DataFrame()
for i in range(5):
tmp_series = pd.Series([i, i*i])
df = df.append(tmp_series, ignore_index=True)
df.columns = ["i", "i^2"]
print(df)
出力結果
i i^2 0 0.0 0.0 1 1.0 1.0 2 2.0 4.0 3 3.0 9.0 4 4.0 16.0







ディスカッション
コメント一覧
まだ、コメントがありません