import numpy as np import pandas as pd # Create dataframe data = {'Company':['GOOG','GOOG','MSFT','MSFT','FB','FB'], 'Person':['Sam','Charlie','Amy','Vanessa','Carl','Sarah'], 'Sales':[200,120,340,124,243,350]} df = pd.DataFrame(data)
print("\nAll in one line of command (Stats of 'FB')\n", '-' * 65, sep = '') print(pd.DataFrame(df.groupby('Company').describe().loc['FB']).transpose())
dxodnd 5년 전
import numpy as np
import pandas as pd
# Create dataframe
data = {'Company':['GOOG','GOOG','MSFT','MSFT','FB','FB'],
'Person':['Sam','Charlie','Amy','Vanessa','Carl','Sarah'],
'Sales':[200,120,340,124,243,350]}
df = pd.DataFrame(data)
print("\nAll in one line of command (Stats of 'FB')\n", '-' * 65, sep = '')
print(pd.DataFrame(df.groupby('Company').describe().loc['FB']).transpose())
이 코드를 실행시켰을 때
All in one line of command (Stats of 'FB')
-----------------------------------------------------------------
Sales
count mean std min 25% 50% 75% max
FB 2.0 296.5 75.660426 243.0 269.75 296.5 323.25 350.0
이렇게 출력이 되는데요. 여기서 std가 왜 75.660426인지 모르겠습니다.
여기서 말하는 std는 표준편차가 아닌지요? 원래대로라면 53.5가 떠야 하는 거 같은데.. ㅠㅠ 도와주세요!