Project 2
Project 2
Analysis
USE weather_db;
# 2. Create DataFrame
df = pd.DataFrame({
'day': days,
'temperature': temperatures
})
# 3. Save to MySQL
try:
conn = mysql.connector.connect(
host="localhost",
user="root",
password="your_password", # Change this!
database="weather_db"
)
cursor = conn.cursor()
finally:
if conn.is_connected():
cursor.close()
conn.close()