Created
March 20, 2015 11:51
-
-
Save daynebatten/1deb653e790c9957f192 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| create temp table | |
| first_scores | |
| as select | |
| first_name, | |
| ln(cast(sum(case when t.gender = 'M' then 1 else 0 end) + 1 as float) / max(num)) as male_score, | |
| ln(cast(sum(case when t.gender = 'F' then 1 else 0 end) + 1 as float) / max(num)) as female_score | |
| from | |
| train as t | |
| left join | |
| ( | |
| select | |
| gender, | |
| cast(count(*) as float) as num | |
| from | |
| train | |
| group by | |
| gender | |
| ) as n | |
| on | |
| t.gender = n.gender | |
| group by | |
| first_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment