Spaces:
Sleeping
Sleeping
More model options
Browse files
app.py
CHANGED
@@ -49,8 +49,8 @@ class References(object):
|
|
49 |
self.raw_results.loc[len(self.raw_results.index)] = [name.first, name.last, paper['title']]
|
50 |
|
51 |
def infer_ethnicity(self):
|
52 |
-
ethnicolr.census_ln(self.raw_results, 'Last Name', 2010)
|
53 |
-
|
54 |
most_likely_race = []
|
55 |
for name in self.raw_results['Last Name']:
|
56 |
if name.upper() in self.ethnicity_lookup:
|
@@ -58,9 +58,10 @@ class References(object):
|
|
58 |
most_likely_race.append(rr)
|
59 |
else:
|
60 |
most_likely_race.append('race_unknown')
|
61 |
-
self.raw_results['Most Likely Ethnicity'] =
|
|
|
62 |
|
63 |
-
for i in
|
64 |
self.ethnicity_results[i] = self.ethnicity_results.get(i, 0) + 1
|
65 |
|
66 |
def infer_gender(self):
|
|
|
49 |
self.raw_results.loc[len(self.raw_results.index)] = [name.first, name.last, paper['title']]
|
50 |
|
51 |
def infer_ethnicity(self):
|
52 |
+
self.raw_results = ethnicolr.census_ln(self.raw_results, 'Last Name', 2010)
|
53 |
+
Get ethnicity
|
54 |
most_likely_race = []
|
55 |
for name in self.raw_results['Last Name']:
|
56 |
if name.upper() in self.ethnicity_lookup:
|
|
|
58 |
most_likely_race.append(rr)
|
59 |
else:
|
60 |
most_likely_race.append('race_unknown')
|
61 |
+
self.raw_results['Most Likely Ethnicity'] = self.raw_results['race']
|
62 |
+
self.raw_results.drop(labels=['race', 'pctwhite', 'pctblack', 'pctapi', 'pctaian', 'pct2prace', 'pcthispanic'])
|
63 |
|
64 |
+
for i in self.raw_results['Most Likely Ethnicity']:
|
65 |
self.ethnicity_results[i] = self.ethnicity_results.get(i, 0) + 1
|
66 |
|
67 |
def infer_gender(self):
|