-
Jupyter-data, csvCording/Python 2021. 1. 17. 02:47
%matplotlib notebook
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import font_manager,rc
#한글 깨짐 방지
font_info='C:/windows/fonts/malgun.ttf'
font_name=font_manager.FontProperties(fname=font_info).get_name()
rc('font",family=font_name)
data=pd.read_csv('accidentdata.csv')
data.head(5)
d2=data[(data.사상자수>=3)]
d2
d3=d2.groupby('요일')
d3['사상자수'].sum().plot(kind='bar',title='2012-2014요일별 중대교통사고사상자분석')
df1=data[data.발생지시도=='경기']
df1
df2=df1.groupby(['발생지시군구'])
df2
df3=df2['사망자수'].sum()
df3
df3.sort_values(ascending=TRUE).tail(5)
import csv
f = open('report.csv')
data = csv.reader(f)
print(data)
f.close()
import csv
f = open('report.csv', encoding = 'utf8')
data = csv.reader(f)
for row in data :
print(row)
f.close()
import csv
f = open('report.csv', encoding = 'utf8')
data = csv.reader(f)
header = next(data)
print(header)
f.close()
import csv
f = open('report.csv', encoding = 'utf8')
data = csv.reader(f)
header = next(data)
# print(header)
fow row in data :
print(row)
f.close()
'Cording > Python' 카테고리의 다른 글
Juypter-계산 (0) 2021.01.20 Jupyter-html table (0) 2021.01.19 jupyter-graph (0) 2021.01.13 Jupyter-data(re) (0) 2021.01.12 Jupyter-str (0) 2021.01.10