Convert csv to sqlite table

in Python with pandas and sqlite3

What you need to install

sqlite3
pandas

Then simply run supported functionality. Here is the sample code

if __name__ == "__main__":
import sqlite3
import pandas as pd

# load data
df = pd.read_csv('../resources/hgnc_data.txt', sep='\t')

# strip whitespace from headers
df.columns = df.columns.str.strip()

con = sqlite3.connect("hgnc.db")

# drop data into database
df.to_sql("hgnc_data", con)

con.close()

And we’re good to go.

~~PEACE~~