반응형

나는야 데이터사이언티스트/PYTHON 45

[Python] 결측치 시각화 하기 - missingno 종류

https://github.com/ResidentMario/missingno ResidentMario/missingno Missing data visualization module for Python. Contribute to ResidentMario/missingno development by creating an account on GitHub. github.com 사용방법은 어렵지 않아 missingno의 종류만 알고 있으면 사용있을 것 같다. 코드는 위의 깃허브 주소로 들어가면 나와있음 ! Matrix Bar Chart Heatmap heatmap은 각 컬럼 null의 상관 관계를 측정합니다. 한 변수의 유무 여부가 다른 변수의 유무에 얼마나 큰 영향을 미치는지 측정합니다. Dendrogram 덴..

[Python/seaborn] 데이터 시각화 - regplot, lmplot, catplot, swarmplot

regplot python seaborn의 regplot은 scatter plot과 line plot을 함께 볼 수 있는 데이터 시각화 방법입니다. 사용방법 : https://seaborn.pydata.org/generated/seaborn.regplot.html lmplot lmplot은 regplot + facegrid를 합친 것으로 regplot을 여러개 보고싶을 때 사용하면 됩니다. 사용방법 : https://seaborn.pydata.org/generated/seaborn.lmplot.html catplot 숫자형 변수와 하나 이상의 범주형 변수의 관계를 보여주는 함수입니다. Categorical scatterplots Categorical distribution plots Categorical..

[Python]문자열 양 끝 공백 또는 문자 제거 - strip(),lstrip(),rstrip()

문자열 양 끝에 있는 공백을 없애야 하는 경우나 특정 문자를 제거하고 싶을 때 사용 -관련 문서 https://docs.python.org/2/library/stdtypes.html?highlight=str.strip#str.strip 5. Built-in Types — Python 2.7.18 documentation The following sections describe the standard types that are built into the interpreter. Note Historically (until release 2.2), Python’s built-in types have differed from user-defined types because it was not possible t..

[Python]matplotlib, dataframe 한글 폰트 설정 방법

python matplotlib에서 한글 폰트, 마이너스(숫자)가 안보일 때 설정하는 방법 #한글폰트 설정 #mac ver. plt.rc("font",family="AppleGothic") #window ver. plt.rc("font",family="Malgun Gothic") #마이너스 숫자 설정 plt.rc("axes",unicode_minus=False) python dataframe 불러올 때, index가 한글일 경우 설정 방법 df= pd.read_csv("../test.csv",encoding = "cp949") UTF-8보다 cp949로 하는게 더 좋음 !

[Python]Dataframe에서 like 검색-str.startswith() , str.contains()

Python Dataframe에서 str을 사용하면 문자열을 사용하기 쉽습니다. str을 사용해서 dataframe에서 SQL의 like search처럼 사용하는 방법을 알아보았습니다. example 데이터프레임 을 살펴보겠습니다. CA_1부터 TX_2까지 있고 item_id도 종류별로 있습니다. 이때 store_id가 'CA' 인 것만 나타내보겠습니다. example[example['store_id'].str.startswith('CA')] store_id가 CA%인 것이 나왔습니다. 여기서 startswith는 앞 문자만 검색가능해 %CA% 같은 검색은 하지 못합니다. 앞뒤 글자 상관없이 특정 단어가 필요한 것을 찾으려면 contains 함수를 사용하면 됩니다. 이번에는 item_id에서 BB글자가 ..

[Python]Jupyter Notebook 잘 사용하기

주피터 노트북을 사용하다보면 markdown으로 파일을 주고 받을 때가 많다. 특히 블로그 업로드 할 때 주피터 노트북을 바로 올리다 보니 다시 볼 때 설명이 많으면 좋다. 그래서 적는 주피터 노트북 잘 사용하기 ! In [1]: #tistory 관련 코드(필요없음) from IPython.core.display import display, HTML display(HTML("")) 1. 수식 넣기¶$ 사이에 수식을 넣으면 가능¶참고 사이트 : https://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Typesetting%20Equations.html $\begin{eqnarray} x' &=& &x \sin\phi &+& z \cos\phi..

[Python]시계열 데이터 모델링 - 기초버전

데이터는 Kaggle에 있는 데이터를 사용했습니다. https://www.kaggle.com/ternaryrealm/airlines-passenger-data Airlines Passenger Data www.kaggle.com In [23]: #tistory 관련 코드(필요없음) from IPython.core.display import display, HTML display(HTML("")) Time series¶데이터 : https://www.kaggle.com/ternaryrealm/airlines-passenger-data 참고 : https://www.kaggle.com/ifitoverfit/international-airlines-passenger-forecast-on-keras In [1]..

[Python] 시계열 데이터 분석 - 기초버전

In [68]: #tistory 관련 코드(필요없음) from IPython.core.display import display, HTML display(HTML("")) import pandas as pd pd.set_option('display.max_columns',500) #생략없이 출력 가능 Time series end to end¶데이터 : https://community.tableau.com/docs/DOC-1236¶참고 페이지 : https://towardsdatascience.com/an-end-to-end-project-on-time-series-analysis-and-forecasting-with-python-4835e6bf050b¶시계열 참고¶ https://datasc..

[Python] 용량이 큰 CSV 파일 빠르게 불러오기

데이터는 Kaggle에 있는 bostan marathon 데이터를 참고했다. https://www.kaggle.com/rojour/boston-results Finishers Boston Marathon 2015, 2016 & 2017 This data has the names, times and general demographics of the finishers www.kaggle.com Untitled csv 파일 빠르게 불러오기(작업 효율성 증가)¶ In [29]: #tistory 관련 코드(필요없음) from IPython.core.display import display, HTML display(HTML("")) In [1]: import pandas as pd In [4]: %%time mar..

[Python]데이터 시각화, 연관성 분석 heat map, pairplot 그리기

데이터는 Kaggle에 있는 bostan marathon 데이터를 참고했다. https://www.kaggle.com/rojour/boston-results Finishers Boston Marathon 2015, 2016 & 2017 This data has the names, times and general demographics of the finishers www.kaggle.com In [12]: #tistory 관련 코드(필요없음) from IPython.core.display import display, HTML display(HTML("")) heatmap¶correlation http://seaborn.pydata.org/generated/seaborn.heatmap.html In [1]..

반응형