Spaces:
Running
Running
NA
Browse files
app.py
CHANGED
@@ -160,15 +160,15 @@ def setup_db():
|
|
160 |
hf_token = os.getenv('HF_TOKEN')
|
161 |
|
162 |
# Load data into ev_population table
|
163 |
-
df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Population_Data.csv",
|
164 |
df.to_sql('ev_population', conn, if_exists='replace', index=False)
|
165 |
|
166 |
# Load data into county_registrations table
|
167 |
-
df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Population_Size_History_By_County.csv",
|
168 |
df.to_sql('county_registrations', conn, if_exists='replace', index=False)
|
169 |
|
170 |
# Load data into ev_registrations table
|
171 |
-
df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Title_and_Registration_Activity.csv",
|
172 |
df.to_sql('ev_registrations', conn, if_exists='replace', index=False)
|
173 |
|
174 |
# Commit changes and close connection
|
|
|
160 |
hf_token = os.getenv('HF_TOKEN')
|
161 |
|
162 |
# Load data into ev_population table
|
163 |
+
df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Population_Data.csv", token=hf_token)['train'].to_pandas()
|
164 |
df.to_sql('ev_population', conn, if_exists='replace', index=False)
|
165 |
|
166 |
# Load data into county_registrations table
|
167 |
+
df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Population_Size_History_By_County.csv", token=hf_token)['train'].to_pandas()
|
168 |
df.to_sql('county_registrations', conn, if_exists='replace', index=False)
|
169 |
|
170 |
# Load data into ev_registrations table
|
171 |
+
df = load_dataset("vectara/ev-dataset", data_files="Electric_Vehicle_Title_and_Registration_Activity.csv", token=hf_token)['train'].to_pandas()
|
172 |
df.to_sql('ev_registrations', conn, if_exists='replace', index=False)
|
173 |
|
174 |
# Commit changes and close connection
|