Skip to content

Instantly share code, notes, and snippets.

@deepanshumehtaa
Last active July 28, 2024 14:47
Show Gist options
  • Save deepanshumehtaa/34223c3f9f5632c95760fba336491b51 to your computer and use it in GitHub Desktop.
Save deepanshumehtaa/34223c3f9f5632c95760fba336491b51 to your computer and use it in GitHub Desktop.
populate_db_pandas.py
from db_connector import SQLHelper
import pandas as pd
chunk_size = 20 # Number of rows in chunks
chunks = []
file_name = 'customers-100.csv'
for chunk in pd.read_csv(file_name, chunksize=chunk_size, delimiter=","):
df: pd.DataFrame = chunk
df.drop("Phone 2", inplace=True, axis=1)
keys = df.keys() # list of columns
# print(df.to_dict(orient="index"))
# print(df.values) # [[...], [...], ]
break
print(chunks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment