import pandas as pd
df.shape -> 행, 열 몇개인지 확인
df.type -> data가 어떤 형태인지 확인
*int64 : 정수형 float : 실수형 object : 문자열, 복합형
-> Data 다루기 전 반드시 Null 값을 확인해야함!!
df.isnull().sum()
len(df['col'].unique()) 또는 df['col'].unique
import numpy as np
df.replace(old_col, new_col)
ex) df.replace(col, np.NaN) <-특정값을 null값으로 치환!
import numpy as np
df.fillna(method='ffill')
*ffill : 앞 Data로 채워넣기 bfill : 뒤 Data로 채워넣기
df= df[['col1','col2']]
df [(필요한 조건1) & (필요한 조건2)]
df['col'].sort_values(ascending=False)
df[df['col']. astype[str].str.contains('text')]
np. where[df['col'] <= 5,1,0]
-> 특정 'col'이 5 이하일 경우 1, 그렇지 않을 경우에는 0으로 바꿔줘라!
-> if where 대신 사용하기도 함
df['특정열'].groupby(df['그룹화 하고 싶은 col']).value_counts()
df_job = pd.pivot_table(df_job, # 피벗할 데이터프레임
index = 'index', # 행 위치에 들어갈 열
columns = 'col', # 열 위치에 들어갈 열
values = 'value') # 데이터로 사용할 열
df.drop_duplicates(['col'], keep = 'first', inplace=True)
df['col'].str.lstrip()
all_list = list(df['start']) + list(df['end'])
unique_list = set(all_list)
-> fillna 가 먹히지 않을때!
df['col'].replace([np.inf, -np.inf], np.nan)