CSV Input
import numpy as np
import pandas as pd
df = pd.read_csv('example')
CSV Output
df.to_csv('example',index=False)
Excel Input
pd.read_excel('Excel_Sample.xlsx',sheetname='Sheet1')
Excel Output
df.to_excel('Excel_Sample.xlsx',sheet_name='Sheet1')
HTML Input
# 필요시 설치하세요
conda install lxml
conda install html5lib
conda install BeautifulSoup4
df = pd.read_html('http://www.fdic.gov/bank/individual/failed/banklist.html')
df[0]
SQL (Optional)
from sqlalchemy import create_engine
engine = create_engine('sqlite:///:memory:')
df.to_sql('data', engine)
sql_df = pd.read_sql('data',con=engine)
sql_df
'''
index a b c d
0 0 0 1 2 3
1 1 4 5 6 7
2 2 8 9 10 11
3 3 12 13 14 15
'''
Great Job!
'Python > Numpy & Pandas' 카테고리의 다른 글
Matplotlib Concepts Lecture (0) | 2020.12.02 |
---|---|
--- (0) | 2020.12.02 |
06-Operations (0) | 2020.12.01 |
05-Merging, Joining, and Concatenating (0) | 2020.12.01 |
04-Groupby (0) | 2020.12.01 |