Skip to content

Instantly share code, notes, and snippets.

@VictorSaenger
Created October 7, 2019 09:48
Show Gist options
  • Select an option

  • Save VictorSaenger/1af737da79ca5c0711fc1a0059792d4e to your computer and use it in GitHub Desktop.

Select an option

Save VictorSaenger/1af737da79ca5c0711fc1a0059792d4e to your computer and use it in GitHub Desktop.
#Density:
p = 0.4
df = pd.read_csv('articles2.csv',header=None,skiprows=lambda i: 1>0 and random.random() > p)
#First batch:
n_s_a = df[df[3] == 'Atlantic']
n_s_p = df[df[3] == 'New York Post']
#Second batch:
df = pd.read_csv('articles1.csv',header=None,skiprows=lambda i: 1>0 and random.random() > p)
n_s_b = df[df[3] == 'Breitbart']
n_s_n = df[df[3] == 'New York Times']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment