LoginSignup
1
1

More than 3 years have passed since last update.

pandasでリストをくっつけてDataFrameにする

Posted at

やりたいこと

リストを下に足していってDataFrameを作成する

作り方

任意のリストrandam_listを下に追加していきます。

df_randam = pd.Series(randam_list,index=df.columns)
df = df.append(df_randam,ignore_index=True)

randam_listの要素数がdfのindexの数と一致していないと、エラーが出るので気を付けてください。
また、df.append()の時のignore_index=Trueなしでエラーが出たので、同じようにはまった人は付けてみて下さい。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1