Python programming(31)
-
Pass = 아무 것도 안하고 넘어간다
제곧내
2020.06.16 -
Public Private Protected 2020.06.14
-
List Comprehensions(JSON 포함) , Lambda Functions
1. json.loads() method string을 포함한 JSON 데이터를 파이썬 오브젝트 set으로 변환해줌 2. json.load() function To read a file from JSON format json.loads() : for loading JSON data from a string ("loads" is short for "load string") json.load() : for loading from a file object 3. Pandas의 pandas.read_json() 4. Pandas의 pandas.DataFrame( ) contructor - JSON의 dictionary 리스트를 (바로 통과시켜서) dataframe으로 변환함 pass the list of dict..
2020.03.16 -
[참고] real world data set 모음
Data.gov - A directory of government data downloads /r/datasets - A subreddit that has hundreds of interesting data sets Awesome datasets - A list of data sets hosted on GitHub rs.io - A great blog post with hundreds of interesting data sets 출처 : dataquest
2020.03.08 -
[참고] Loan Prediction - github
https://github.com/dataquestio/loan-prediction
2020.03.08 -
정규 표현식 Regular Expression Syntax
1. re module: built-in module for regular expressions 2. re.search() function - The regex pattern / The string we want to search that pattern for - a set by placing the characters we want to match for in square brackets [ ] 예시 ) 예시2) string_list = ["Julie's favorite color is Blue.", "Keli's favorite color is Green.", "Craig's favorite colors are blue and red."] blue_mentions = 0 pattern = "[Bb]l..
2020.03.01 -
Transforming Data With Pandas
(1) Series.map( ) Series.map(function_name) 이런 식으로 function 적용시키는 method임 (2) Series.apply() def label(element, x): if element > x: return 'High' else: return 'Low' economy_impact_apply = happiness2015['Economy'].apply(label, x=0.8) 이런 식으로 어떤 Series에 element-wise하게 함수 적용시키고 싶을 때 apply method를 쓴다. 단, apply 메소드는 vectorization이 없을 때만 쓸 것! 왜냐면 pandas uses vectorization, the process of applying opera..
2020.01.18 -
기초통계 : 평균, 분산
1. for 문으로 리스트 내의 값을 순차적으로 하나씩 불러와서 누적하여 더하기 (for 반복문으로 평균 구하기) 2. for 문으로 distribution 구하기 3.
2019.12.21 -
또다른 plot 그리기
1. 수직 바그래프 Series.plot.bar() method 관련 문서 : https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.plot.bar.html 2.수평 바그래프 Series.plot.barh() test = wnba['Exp_ordinal'].value_counts().iloc[[3,0,2,1,4]] test.plot.barh() 3. 파이 그래프 Series.plot.pie() 예를 들어, wnba['Pos'].value_counts().plot.pie() wnba['Exp_ordinal'].value_counts().plot.pie(figsize =(6,6), autopct = '%.2f%%', title='P..
2019.12.15 -
★★pandas - pd.concat()와 pd.merge(), 문자 데이터 다루기 Working With Strings In Pandas (데이터 클렌징시 유용)
(1) pd.concat( [ df1, df2 ] , ignore_index=True ) (2) pd.merge( left = , right= , on = '컬럼이름', how = 'left' ) Inner: only includes elements that appear in both dataframes with a common key [디폴트] Outer: includes all data from both dataframes Left: includes all of the rows from the "left" dataframe along with any rows from the "right" dataframe with a common key; the result retains all columns fro..
2019.11.27