Cording
-
Juypter-계산Cording/Python 2021. 1. 20. 22:57
df.sum(axis=0) > 열의 합계 df.sum(axis=1) > 행의 합계 df.mean() > 열의 평균 df.loc['a'].mean() > a열 평균 df.var() df.one = df.one.fillna(0) > one: 열 표시(NaN를 0으로) two = df['two'].min() df['two'] = df['two'].fillna(value=two) df df.std() df.min(axis=1) df.max(axis=0) df.count(axis=1) # index 기준 정렬 df2.sort_index(axis=0, ascending=FALSE)
-
Jupyter-html tableCording/Python 2021. 1. 19. 21:51
import pandas as pd df = pd.read_html('https://en.wikipedia.org/wiki/All-time_Olympic_Games_medal_table') print(df) df[1] import pandas as pd df = pd.read_html('https://en.wikipedia.org/wiki/All-time_Olympic_Games_medal_table', header=0, index_col=0) print(df) df[1] summer = df[1].iloc1:,:5] summer summer.colums = ['경기수', '금', '은', '동', '계'] summer.sort_values('금', ascending=False) summer.to_exc..
-
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-..
-
Jupyter-data filteringCording/Python 2021. 1. 9. 00:59
#txt 파일 읽어오기 df2=pd.read_csv("푼다.txt",engine='python') df2 df2=pd.read_table("푼다.txt",engine='python',sep=',') df2 import pandas as pd df=pd.read_excel('highwaybus.xlsx',sheetname='highway',encoding='cp949') df.head() # 필터링1=우등 고속 데이터 대상 df_ex=df[df.차종=='우등'] df_ex.head() # 필터링2=경부선 총이용인원 1000명 이상인 데이터 분석 df_gx=df[(df.선별=='경부선')&(df.총이용인원>=1000)] df_gx.head(3) df_gx.sort_values(by='총이용인원',ascend..