サンプル

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

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です