0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Python】整然データ

Posted at

整然データは、いわゆる「縦持ち」のデータで、定義は以下となります。

【1】各変数が1つの列で構成されている
【2】各観測が1つの行で構成されている
【3】各観測単位が1つの表で構成されている

データ分析や機械学習は、整然データのほうが扱いやすいことが多いです。

例えば、グラフを描画するPlotly Expressのcolor引数は、縦持ちのデータで指定する必要があります。

df
▶︎
image.png

import plotly.express as px

px.line(
df,
x=df.index,
y='売上',
color='会社')
▶︎
image.png

color引数に「会社」の列を指定しているため、各会社で色分けされています。

次のような横持ちの雑然データの場合、color引数で色分けすることはできません。

df
▶︎
image.png

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?