import pandas as pd

scientists = pd.read_csv('./data/scientists.csv')

print(scientists)
# 피클로 저장
names = scientists['Name']
names.to_pickle('./scientists_names_series.pickle')

# 데이터프레임 피클저장
scientists.to_pickle('./scientists_df.pickle')
# 피클 읽어오기
scientist_names_from_pickle = pd.read_pickle('./scientists_names_series.pickle')
print(scientist_names_from_pickle)

scientist_from_pickle = pd.read_pickle('./scientists_df.pickle')
print(scientist_from_pickle)
# csv 저장
names.to_csv('./scientist_names_series.csv')
scientists.to_csv('./scientist_df.tsv', sep='\t')
# 엑셀파일 저장
# pip install xlwt
# pip install openpyxl

names_df = names.to_frame() # Series를 DataFrame로 변환

import xlwt
names_df.to_excel('./scientists_names_series_df.xls')

import openpyxl
names_df.to_excel('./scientists_names_series_df.xlsx')

+ Recent posts