6
11

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 5 years have passed since last update.

Pythonでグラフ作成(散布図)

Posted at

記録として残していきます。

そのままコピーしてやればできます。

使用したデータ(csvファイル)がうまく掲載できなかったので、写真で貼っておきます。

スクリーンショット 2017-11-01 午前1.38.15.png

statistics.py
import pandas as pd
import matplotlib.pyplot as plt
from pandas.plotting import scatter_matrix
statistics.py
data = pd.read_csv("row_data.csv")
data.describe()
statistics.py
plt.scatter(data['age'], data['expenses'])
plt.ylabel('expenses')
plt.xlabel('age')
plt.show()

スクリーンショット 2017-11-01 午前1.33.16.png

statistics.py
plt.scatter(data['smoker'], data['expenses'])
plt.ylabel('expenses')
plt.xlabel('smoke')
plt.show()

スクリーンショット 2017-11-01 午前1.33.22.png

statistics.py
plt.scatter(data['bmi'], data['expenses'])
plt.ylabel('expenses')
plt.xlabel('bmi')
plt.show()

スクリーンショット 2017-11-01 午前1.33.33.png

statistics.py
plt.figure()
scatter_matrix(data)
plt.show()

スクリーンショット 2017-11-01 午前1.33.41.png

6
11
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
6
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?