0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Pandasの基本的な分析操作

Posted at

Pandasの基本的な分析操作

個人的に覚えておきたいコード

#データのソート(昇順)
df.sort_values('Weight').head()

#データのソート(降順)
df.sort_values('Weight', ascending=False).head()

#列の削除
df = df.drop(labels = 'Origin' , axis=1)

#データの絞り込み
df[df['Origin'] == 3].head()

#データの絞り込み2
df[(df['Origin']==3) & (df['Weight']>=2000)].head()

#要約統計量の確認
df.describe()

#グループ化
df.groupby('Origin').mean()

#クロス集計表
pd.crosstab(df['Cylinders'],df['Origin'])

#ピボットテーブル
pd.pivot_table(df, values='MPG', index='Model Year', columns='Origin', aggfunc='mean')

dropとかは今のところよく使いますね

0
2
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
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?