Data Cleaning and Wrangling
Fix types, remove duplicates, handle missing values and reshape data into a usable form.
Beginner
df = df.drop_duplicates()
df["time"] = pd.to_datetime(df["time"])
df["value"] = pd.to_numeric(df["value"], errors="coerce")
wide = df.pivot(index="time", columns="sensor", values="value")
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.