Last active
July 28, 2024 14:47
-
-
Save deepanshumehtaa/34223c3f9f5632c95760fba336491b51 to your computer and use it in GitHub Desktop.
populate_db_pandas.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
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