Last active
August 14, 2019 17:54
-
-
Save kiwi0fruit/8515a3ed2f06c4daa9669c846982629d to your computer and use it in GitHub Desktop.
db.py
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 sqlite3 | |
import pandas as pd | |
from IPython.display import display | |
# change path here | |
conn = sqlite3.connect(r'C:\Users\User\SOLTI_160_ENG__2019_08_07\SOLTI-160w.sqlite') | |
# %% | |
cursor = conn.cursor() | |
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';") | |
print(cursor.fetchall()) | |
# %% | |
df_end, df_raw, df_out = tuple( | |
pd.read_sql_query(f"SELECT * FROM {name}", conn) | |
for name in ('DB_end', 'DB_raw', 'DB_out') | |
) | |
print(type(df_out['date'][0])) | |
# %% | |
display(df_end) | |
# %% | |
display(df_raw) | |
# %% | |
display(df_out) | |
# %% | |
display(df_out.dtypes) | |
# %% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment