Created
January 29, 2023 10:24
-
-
Save SnowyPainter/58d5ae1a58569dcdeee51ac7cb4de816 to your computer and use it in GitHub Desktop.
This file contains 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
import pandas as pd | |
code_df = pd.read_csv('2021licode.csv') | |
stat_df = pd.read_csv('2021listat.csv') | |
code_df = code_df.drop(code_df.columns[[3,4,5]], axis=1) | |
code_df = code_df.iloc[3:-1] | |
def counted_tag(tag): | |
l = [x for x in stat_df[tag].tolist() if str(x) != 'nan'] | |
return dict((x,l.count(x)) for x in set(l)) | |
print("Q8A1 computer search") | |
print(counted_tag("Q8A1")) | |
print("Q8B1 phone search") | |
print(counted_tag("Q8B1")) | |
print("Q8A4 computer edu search") | |
print(counted_tag("Q8A4")) | |
print("Q8B4 phone edu search") | |
print(counted_tag("Q8B4")) | |
def compare_wt1(): | |
#Q1A1 ~ Q8B4 | |
wt1_df = stat_df[stat_df['WT'] == 1.00] | |
print(wt1_df.iloc[:,2:34].sum(axis=1).sum(axis=0)) #521 | |
wtl1_df = stat_df[stat_df['WT'] < 1.00] | |
print(wtl1_df.iloc[:,2:34].sum(axis=1).sum(axis=0)) #1013 | |
wto1_df = stat_df[stat_df['WT'] > 1.00] | |
print(wto1_df.iloc[:,2:34].sum(axis=1).sum(axis=0)) #666 | |
compare_wt1() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment