본문 바로가기

파이썬. 데이터분석/Seaborn11

Seaborn : sns.lineplot 시계열 그래프, pd.to_datetime 기본형 axes-level이다. pd.to_datetime을 이용하여 object를 datetime으로 sns.lineplot(data=economics_2014, x = 'month', y = 'psavert') 2014년 데이터만 월 분석 2022. 7. 31.
Seaborn : sns.countplot countplot 기본형 sns.barplot으로 개수세고 그래프 그리기(귀찮음) 2022. 7. 30.
Seaborn : sns.barplot barplot 기본형 sort_values로 정렬 차종(category)이 suv고 제조업체별로 cty(도심에서 연비) 평균이 높은 순서대로 정렬에서 barplot으로 만들기 city_mean = mpg.query('category == "suv"').groupby('manufacturer', as_index = False).agg(cty_mean = ('cty', 'mean')) \ .sort_values('cty_mean', ascending=False) city_mean.head(5) category뱔 빈도 표현 막대그래프 df = mpg.groupby('category', as_index = False).agg(n=('category', 'count')).sort_values('n', ascend.. 2022. 7. 30.
Seaborn : scatterplot xlim sns.scatterplot(data=midwest, x='poptotal', y='popasian') sns.scatterplot(data=midwest, x='poptotal', y='popasian').set(xlim=(0, 500000), ylim=(0, 10000)) 2022. 7. 30.
Seaborn : boxplot, 이상값 제거(1.5IQR) 한번에 여러개 만들기 in list를 이용해서 원하는 데이터만 boxplot import seaborn as sns import matplotlib.pyplot as plt plt.figure(figsize=(5,7)) sns.boxplot(data = mpg, y='hwy') sns.set_style('whitegrid') sns.set_context('paper') #이상값 제거 import numpy as np pct25 = mpg['hwy'].quantile(0.25) pct75 = mpg['hwy'].quantile(.75) iqr = pct75 - pct25 max = pct75 + 1.5 * iqr min = pct25 - 1.5 * iqr mpg['hwy'] = np.where((mpg['.. 2022. 7. 28.
◆Seaborn : figure-level, axes-level 차이 https://hwi-doc.tistory.com/entry/seaborn-%EC%99%84%EB%B2%BD-%EC%A0%95%EB%A6%AC?category=938350 seaborn 완벽 정리 여러분은 처음 seaborn을 어떻게 사용했나요? seaborn이 시각화에 좋다고 해서 그냥 import seaborn as sns 를 하고, 있을 법한 그래프를 메소드로 써서 실행시켜보시지는 않았나요? displot이 어떤 plot인지 hwi-doc.tistory.com https://seaborn.pydata.org/tutorial/function_overview.html Overview of seaborn plotting functions — seaborn 0.11.2 documentation In add.. 2022. 7. 19.
Seaborn : plot xticks, yticks만 크기 조절하는법 https://stackoverflow.com/questions/42404154/increase-tick-label-font-size-in-seaborn Increase tick label font size in seaborn I have a huge problem with my seaborn plots. For some reason, the numbers along the axis are printed with a really small font, which makes them unreadable. I've tried to scale them with with plt. stackoverflow.com sns.set(font_scale = 2)는 모든 크기를 다 키운다. xticks, yticks만 띄우.. 2022. 7. 18.
Seaborn : relplot (hue,style,col,size) hue hue는 색깔로 구분 hue에다가 object뿐만 아니라 수치(정수,소수)도 넣을수있다 style style는 marker의 형태로 구분. 작아서 안보이는데 Adelie는 'O' 모양 Chinstrap은 'ㅁ' 모양 Gentoo는 'x' 모양 hue랑 style을 동시에 보면 col size size로 marker의 크기를 조절한다 Gentoo애들이 기본적으로 체중이 나가고 bill_depth가 낮고 상관관계가 있는편. Adelie애들이 bill_length가 낮구나 bill_depth는 높은편 Chinstrap이 bill_length도 높고 bill_depth도 높은편 2022. 7. 18.