Skip to content

Instantly share code, notes, and snippets.

@mirth
Last active September 19, 2020 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mirth/e01ba1b7c250c87bd8eca3b72f0ca988 to your computer and use it in GitHub Desktop.
Save mirth/e01ba1b7c250c87bd8eca3b72f0ca988 to your computer and use it in GitHub Desktop.
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