반응형

출처: http://stackoverflow.com/questions/3061761/numpy-array-dimensions


.shape()

- shape함수를 사용하면 데이터 구조 확인 가능

(행렬 정보)

반응형
반응형

출처: http://stackoverflow.com/questions/24493918/pandas-set-cell-format-in-excel-writer


import pandas as pd

....


writer = pd.ExcelWriter('test.xlsx')

df1.to_excel(writer, 'Sheet1')

df2.to_excel(writer, 'Sheet2')

writer.save()

.... 


- pd.ExcelWriter로 저장할 엑셀 파일 객체 생성

- 해당 객체에 dataframe값을 to_excel 함수를 이용해서 내보냄 with 시트명

반응형
반응형

출처: http://stackoverflow.com/questions/10715965/add-one-row-in-a-pandas-dataframe

 

Pandas에서 새로운 데이터 프레임 생성하고 값을 추가할 때

df = DataFrame(columns=('number', 'name'))
df.loc[0] = [1, '박명수']
df.loc[1] = [2, '유재석']
...

 

데이터 프레임에 컬럼을 추가해주고, 해당 데이터를 loc 함수를 이용해서 넣어주면 됨

반응형

+ Recent posts