[Python] 15. pandas DataFrame 통계&시각화 : sum(), unstack(), mean(), values, min(), idxmax(), median(), quantile(), count(), describe()예제
import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import matplotlib rc('font', family='AppleGothic') plt.rcParams['axes.unicode_minus'] = False data = {'eng':[10,30,50,70], 'kor':[20,40,60,80], 'math':[90,50,20,70]} df = pd.DataFrame(data, index=['a','b','c','d'] ) df def fn( v ): print("=========") print("v=>",v) print("=========") return v.sum() d..
[Python] 07. pandas Series 통계/시각화 : idxmax(),idxmin(),nlargest(),nsmallest(),quantile(),cut(),to_csv() 예제
import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import matplotlib rc('font', family='AppleGothic') plt.rcParams['axes.unicode_minus'] = False data = {'aa':10,'bb':20,'cc':30,'dd':40,'ee':50} sr = pd.Series(data, name='국어점수') sr [OUT] : aa 10 bb 20 cc 30 dd 40 ee 50 Name: 국어점수, dtype: int64 sr.idxmax() # numpy에서는 argmax()이고 pandas에서는 idxmax() [OUT]..