VOOZH about

URL: https://qiita.com/tsawa/items/18d8989f477f5cf4198a

⇱ Pythonでグラフ作成(散布図) #Python3 - Qiita


👁 Image
6

Go to list of users who liked

11

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

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

6
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

Go to list of users who liked

11
0

Go to list of comments

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

Go to list of users who liked

11