Skip to content

Instantly share code, notes, and snippets.

@akashlevy
Created November 18, 2022 06:39
Show Gist options
  • Save akashlevy/d18d16aa9dffa9c3a147c825dbe7a303 to your computer and use it in GitHub Desktop.
Save akashlevy/d18d16aa9dffa9c3a147c825dbe7a303 to your computer and use it in GitHub Desktop.
5-line CSV merge :)
import pandas as pd
metrics = pd.read_csv("metrics.csv", skipinitialspace=True)
perms = pd.read_csv("perms.csv", skipinitialspace=True).iloc[:,:-1]
result = pd.merge(metrics, perms, how="inner", on=["id", "session"])
result.to_csv("merged.csv", index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment