forked from jhinericusername/waterview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmerger.py
More file actions
16 lines (11 loc) · 770 Bytes
/
merger.py
File metadata and controls
16 lines (11 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import pandas as pd
# Load your event dataset into a DataFrame (replace 'event_data.csv' with your file path)
event_df = pd.read_csv("datasets/final_data/complete_event_list.csv")
# Load your water quality dataset into another DataFrame (replace 'water_quality_data.csv' with your file path)
water_quality_df = pd.read_csv("datasets/final_data/cwi.csv")
# Assuming both datasets have a 'date' column, convert it to a datetime format
event_df["Date"] = pd.to_datetime(event_df["Date"])
water_quality_df["Date"] = pd.to_datetime(water_quality_df["Date"])
# Merge the two DataFrames based on the 'date' column
merged_df = pd.merge(event_df, water_quality_df, on="Date", how="inner")
merged_df.to_csv("datasets/final_data/merged_data.csv", index=False)