Last active
September 19, 2020 16:07
-
-
Save mirth/e01ba1b7c250c87bd8eca3b72f0ca988 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from pathlib import Path | |
def get_ytid(x): | |
name = Path(x).name | |
ytid = name[: name.rfind('_')] | |
return ytid | |
maybe_noise = pd.read_csv('Engine+noises_2020-08-24T19_34_31.csv') | |
maybe_healthy = pd.read_csv('Engine+healthy_2_2020-08-24T22_17_40.csv') | |
noise = maybe_noise[maybe_noise.sound == 'is_sound'].copy() | |
healthy = maybe_healthy[maybe_healthy.sound == 'is_sound'].copy() | |
noise['target'] = 1 | |
healthy['target'] = 0 | |
df = pd.concat([noise, healthy]) | |
df['ytid'] = df.sample_uri.apply(get_ytid) | |
df.to_csv('noise_and_healthy.csv', index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment