| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Python Numpy
- 스코어카드 예시
- 25년 3월 미국 증시 분석
- 미국 투자 분석
- 2025년도 미국 관세
- css 리스크
- 미국 증시 방향성
- 연체용어
- 연체 css
- css risk
- 트럼프 2025년 미국 관세
- 미국 시황
- Cudnn 버전 확인
- 딥러닝
- 취업사이트 정리
- 딥러닝 제대로 시작하기
- css 리스크관리
- jupyter notebook PDF
- 트럼프 미국 관세
- 주식 데이터 수집
- 25년 3월 12일 미국 증시 분석
- 25년 3월 11일 미국 증시 분석
- 미국 증시 분석
- 관세 설명
- 코딩 사이트 정리
- 미장 분석
- 스코어카드 만드는법
- 2025년 3월 6일 미국 증시 분석
- 25년 3월 증시 분석
- python pandas
Archives
- Today
- Total
koos808
내가 자주 쓰는 Python Pandas 함수 - Part1 본문
728x90
반응형
※ 자주 쓰는 Pandas 함수
-
csv 불러오기, 저장
pd.read_csv('경로/data.csv')dataframe.to_csv("저장할 csv파일 경로", header=False, index=False)
-
열이름 가져오는 가장 간단한 코드
df.columns.values.tolist()orlist(df.columns)
-
행과 열 개수 가져오기
- 행 :
df.shape[0],len(df),len(df.index) - 열 :
df.shape[1],len(df.columns)
- 행 :
-
변수 타입 확인
type()
-
특정 컬럼의 데이터 타입 변경
df = df.astype({'col1': 'int'})
-
특정 열 제외하고 가져오기
colsum=[1,3,9]orcolsum=arrange(0,40)- 이후
df.iloc[:, ~df.columns.isin(df.columns[colsnum])]
-
열 선택
ind = ['a', 'b', 'c']->data = data[ind]
-
열 삭제 여러가지 방법
deldel df['C']
dropdf.drop(['B', 'E'], axis='columns', inplace=True)- df = df.drop(['B', 'E'], axis=1) #without the option inplace=True
- 열 번호에
drop사용df.drop(df.columns[[0, 2]], axis='columns')
-
변경하고 싶은 열 이름 변경
- df =
df.rename(columns={'oldName1': 'newName1', 'oldName2': 'newName2'}) - rename the existing DataFrame (rather than creating a copy)
df.rename(columns={'oldName1': 'newName1', 'oldName2': 'newName2'}, inplace=True)or `df.rename({'oldName1': 'newName1', 'oldName2': 'newName2'}, inplace=True,axis=1)`
- df =
-
DataFrame(데이터 프레임) 만들기 기초적인 방법
raw_data = { 'val_loss': hist_val_loss, 'val_accuracy': hist_val_accuracy, 'loss': hist_loss, 'accuracy': hist_accuracy } data = pd.DataFrame(raw_data)
728x90
반응형
'Python' 카테고리의 다른 글
| Python 연산자 관련 코드 - 곱하기, 나누기, 나머지, 몫 (0) | 2021.01.06 |
|---|---|
| 내가 자주 쓰는 Python Pandas 함수 - Part2 (0) | 2020.11.28 |
| Python os.path 모듈 path 경로 설정 (0) | 2020.11.17 |
| Python 내장함수 zip() 함수 (0) | 2020.11.17 |
| Python pyplot, matplotlib, plt 에서 한글 깨짐 문제 해결법 (0) | 2020.11.16 |
Comments