Muthu Posted on May 27, 2019 6 Read/Write data from/to SQLITE using Python Pandas #pandas #python data-engineering (2 Part Series) 1 Read/Write data from/to SQLITE using Python Pandas 2 Read Excel sheet using Pandas PUSH EXCEL FILE TO SQLITE FILE import pandas as pd import sqlite3 EXCEL_FILE_NAME = 'source.xlsx' DB_NAME = 'stage.db' df= pd.read_excel(open(EXCEL_FILE_NAME , 'rb'),skiprows=3,index=False) conn = sqlite3.connect(DB_NAME) df.to_sql('source', conn) Enter fullscreen mode Exit fullscreen mode READ FROM SQLITE import pandas as pd import sqlite3 DB_NAME = 'stage.db' conn = sqlite3.connect(DB_NAME) sql_string = 'select * from source_tbl where id>10' df = pd.read_sql(sql_string, conn) print(df) Enter fullscreen mode Exit fullscreen mode Top comments (0) Subscribe Personal Trusted User Create template Templates let you quickly answer FAQs or store snippets for re-use. Submit Preview Dismiss Code of Conduct • Report abuse Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)