Python독학
-
[Python]_06_pandas_부동산 데이터를 활용한 예제, str.strip(), ,str.replact(),fillna, index를 활용한 drop공부/Python 2021. 6. 3. 14:51
ValueError: invalid literal for int() with base 10: ' ' 1칸 or 2칸 공백이 있음을 의미한다. df['분양가격'] = df['분양가격'].str.strip() # 공백을 제거해준다 ValueError: invalid literal for int() with base 10: '' 공백을 의미한다. df.loc[ df['분양가격'] == '', '분양가격'] = 0 # loc를 이용해 공백에 0을 넣어준다. ValueError: cannot convert float NaN to integer 값이 없음을 의미한다. df['분양가격']=df['분양가격'].fillna(0) # Nan값에 0을 넣어준다. ValueError: invalid literal for in..
-
[Python]_03_pandas_copy, append, max, min, count,..., gruop by, pivot, multi-index, unstack, rest_index()공부/Python 2021. 5. 28. 13:09
3# colab 사용 #강의 10 11 12 13 14 15 1. copy : 원본 데이터 유지시키고, 새로운 변수에 복사할 때 사용. - df.copy() new_df=df.copy() 2. row, column추가 - row 추가 : df.append({ '키' : '값' }, ingnore_index=True) - columns 추가 : df['국적']='대한민국' # row 추가- df.append({},ignore_index=True) # ignore_index=True을 해야 오류 안남 df=df.append({'이름':'테디','그룹':'테디그룹},ignore_index=True) # column 추가- df.['넣을 컬럼명']='넣을 값(문자)' or 넣을 값(숫자) # 문제: 이름이 지드..