Created
August 4, 2016 19:35
-
-
Save joshlk/a87616534b52a1321d4e124ae890f09d to your computer and use it in GitHub Desktop.
Pandas to Sqlite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from sqlalchemy import create_engine | |
df = pd.read_csv('<INPUT_FILE_PATH>.csv', encoding='utf') # Needs to be unicode for sqlite | |
disk_engine = create_engine('sqlite:///<DB_PATH>.sqlite') | |
df.to_sql('<TABLE_NAME>', disk_engine, if_exists='append') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment