Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
3
Help us understand the problem. What is going on with this article?
@DisneyAladdin

【Python】Pandasでデータセットから相関グラフを描写させる

概要

・友達の課題の手伝い
・とりあえず入力データをプロット
・どのあたりに相関があるのかを見出すため,相関直線(近似)を描写
・pandasをあまり使うことがないのでメモを兼ねてQittaに記述

入力データセット(ID,地価,距離)

コード

import seaborn as sns
import pandas as pd
import csv
pal = []
a = open('test.csv','r')
for i in a:
    i = i.rstrip().split(',')
    ID = int(i[0])
    kakaku = int(i[1])
    kyori = float(str(i[2]))
    LINE = [ID,kakaku,kyori]
    pal.append(LINE)#ID,価格,距離情報のリストをpalにアペンドして二次元配列に

print pal

sns.set_style("whitegrid")
tips = pd.DataFrame(pal,columns=('ID','kakaku','kyori'))
tips
sns.regplot(x="kyori",y="kakaku",data=tips)#距離を横軸,価格を縦軸としてプロット!

結果

graph_soukan.png

・結果をみてわかることは,ある地点からの距離が近いほど土地の価格は高く,離れるにしたがって安くなっているということ.
・東京駅かスカイツリーってとこか?

Github

3
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
DisneyAladdin
Pythonが大好物です.

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
3
Help us understand the problem. What is going on with this article?