Skip to content

Instantly share code, notes, and snippets.

@ramiroaznar
Created May 14, 2021 07:03
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 ramiroaznar/77387205830cb86748ead82a916f564f to your computer and use it in GitHub Desktop.
Save ramiroaznar/77387205830cb86748ead82a916f564f to your computer and use it in GitHub Desktop.
Get aggregated metrics from lascallesdelasmujeres geochicas project
import os
import pandas as pd
import json
# clone lascallesdelasmujeres github repository
# cd /lascallesdelasmujeres
json_list = []
for root, dirs, files in os.walk(os.getcwd() + '/data'):
for file in files:
if file == 'stats.txt':
with open(root + '/' + file) as f:
json_data = json.load(f)
json_list.append(json_data)
df = pd.DataFrame(json_list)
print(
df.numFemale.sum(),
df.numMale.sum(),
df.totalNames.sum(),
round(df.numFemale.sum()*100.00/df.totalNames.sum(),2)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment