示例#1
0
#!__*__coding:utf-8__*__
import os
import pandas as pd

######################################
csv = r"data_draw_korea.csv"

m = pd.read_csv(csv, encoding="utf-8", engine="python")
print(m)

import korea_showMap
korea_showMap.drawKorea('면적', m, '광역시도', '행정구역', 'binary')

filename = r"Z:\상가업소정보_2017년_6월\상가업소_201706_01.csv"
a1 = pd.read_csv(filename, engine="python")
filename = r"Z:\상가업소정보_2017년_6월\상가업소_201706_02.csv"
a2 = pd.read_csv(filename, engine="python")
filename = r"Z:\상가업소정보_2017년_6월\상가업소_201706_03.csv"
a3 = pd.read_csv(filename, engine="python")
filename = r"Z:\상가업소정보_2017년_6월\상가업소_201706_04.csv"
a4 = pd.read_csv(filename, engine="python")

df = pd.merge([a1, a2, a3, a4])
#df = pd.read_csv(filename, engine="python")

df[df.상호명.isnull()] = "상호없음"
df_star = df[df.상호명.str.contains("스타벅스")]

df_star.to_excel("스타벅스거르기2.xlsx")

df_star = pd.read_excel("스타벅스거르기2.xlsx")
df2 = df_star[["상호명", "시도명", "시군구명"]]
gf = df2.groupby(["시도명", "시군구명"]).count()
gf = gf.reset_index()
gf.to_excel("스타벅스_상점수.xlsx")

kf = pd.read_csv(r"Z:\20170923_7일차\data_draw_korea.csv", \
                 engine="python", encoding="utf-8")
result = pd.merge(gf, kf, left_on=["시도명","시군구명"], \
                  right_on=["광역시도", "행정구역"], how="right")

import korea_showMap
korea_showMap.drawKorea('상호명', result, '광역시도', '행정구역', 'Reds')
示例#3
0
starbucks = starbucks[["상호명", "시도명", "시군구명"]]
starbucks = starbucks.groupby(["시도명", "시군구명"]).count()
starbucks = starbucks.reset_index()

######################################
csv = r"data_draw_korea.csv"

m = pd.read_csv(csv, encoding="utf-8", engine="python")
print(m)

yy = starbucks.merge(m,
                     how='right',
                     left_on=['시도명', '시군구명'],
                     right_on=['광역시도', '행정구역'])
print(yy)


def convert_float(i):
    i = i.replace(",", "")
    if i.isdigit():
        return float(i)
    else:
        return 0


yy.to_excel("cafebene_지역별_상점수_2017.xlsx")

import korea_showMap
korea_showMap.drawKorea("상호명", yy, "광역시도", "행정구역", "Reds")
示例#4
0
m = pd.read_csv(csv, encoding="utf-8", engine="python")
print(m)

y = z1.merge(m, how='left', left_on='지역', right_on='shortName')
print(y)

y = y[y.x.notnull()]


def convert_float(i):
    i = i.replace(",", "")
    if i.isdigit():
        return float(i)
    else:
        return 0


y["절도2"] = y["절도"].apply(lambda x: convert_float(x))

y.to_excel("output.xlsx")
import korea_showMap

y.index = y.shortName
y.reindex()
#y..pivot(index='y', columns='x', values=targetData)
for i in y.index:
    print(i)
#drawKorea('소멸위기지역', pop, '광역시도', '시도', 'Reds')
korea_showMap.drawKorea("절도2", y, "광역시도", "행정구역", "Reds")
示例#5
0
    starbucks = starbucks[["표준산업분류명", "시도명", "시군구명"]]
    starbucks = starbucks.groupby(["시도명", "시군구명"]).count()
    starbucks = starbucks.reset_index()

    ######################################
    csv = r"data_draw_korea.csv"

    m = pd.read_csv(csv, encoding="utf-8", engine="python")
    print(m)
    dfb.apply

    yy = starbucks.merge(m,
                         how='right',
                         left_on=['시도명', '시군구명'],
                         right_on=['광역시도', '행정구역'])
    print(yy)

    def convert_float(i):
        i = i.replace(",", "")
        if i.isdigit():
            return float(i)
        else:
            return 0

    yy.to_excel("chicken_지역별_상점수_2017.xlsx")

    import korea_showMap

    korea_showMap.drawKorea("표준산업분류명", yy, "광역시도", "행정구역", "Reds")
示例#6
0
문제- 수원이 정말 치킨집이 하나도 없을까? 데이터를 분석해서 해결한다.

"""
import os
import pandas as pd
import korea_showMap

#######################################################################
# 기본 csv 파일로 지도 만드는 샘플
#######################################################################
csv = r"data_draw_korea.csv"

m = pd.read_csv(csv, encoding="utf-8", engine="python")
print(m)

korea_showMap.drawKorea('면적', m, '광역시도', '행정구역', 'OrRd')

#######################################################################
# 기본 csv 파일로 지도 만드는 샘플
#######################################################################

datafiles = [
    r"C:\Users\505\Downloads\상가업소_201609\상가업소_201609_01.csv",
    r"C:\Users\505\Downloads\상가업소_201609\상가업소_201609_02.csv",
    r"C:\Users\505\Downloads\상가업소_201609\상가업소_201609_03.csv",
    r"C:\Users\505\Downloads\상가업소_201609\상가업소_201609_04.csv"
]

# if not os.path.isfile("korea_blockmap.xlsx"):
df_list = []