def generalData(Bibliography): df1 = nfv.dfFix(Bibliography, "Mujeres menores de 5 aƱos (%)", "Total population") df2 = nfv.dfFix(Bibliography, "Growth rate of populatoin (%)", "Culture") GD_Demography = nt.concatDF(df1, df2) nt.mkCSV(GD_Demography, "GD_Demography.csv") GD_Ethnicgroup = nfv.dfFix(Bibliography, "Ethnich group 1", "Religion").T nt.mkCSV(GD_Ethnicgroup, "GD_Ethnicgroup.csv") df1 = nfv.dfFix(Bibliography, "Parliamentary republic", "Territorial and Urbanistic") GD_Government = df1 GD_Government = GD_Government.isin(["Si"]) GD_Government = GD_Government.any( ) #Lista con indice de columna y True si un contiene un True o False en caso contrario GD_Government = list( GD_Government[GD_Government == True].index) #lista de indices con true GD_Government = pd.DataFrame(GD_Government) nt.mkCSV(GD_Government, "GD_Government.csv") GD_Economy = nfv.dfFix(Bibliography, "Agriculture (%)", "Government") nt.mkCSV(GD_Economy, "GD_Economy.csv") df1 = nfv.dfFix(Bibliography, "Urban population (%)", "Population density") df2 = nfv.dfFix(Bibliography, "Urban (inhabitants/hectares)", "Infrastructures") GD_Urbanism = nt.concatDF(df1, df2) nt.mkCSV(GD_Urbanism, "GD_Urbanism.csv") df1 = nfv.dfFix(Bibliography, "Rural agua (%)", "Access to improved sanitation") df2 = nfv.dfFix(Bibliography, "Rural saneamiento(%)", "Access to electricity") df3 = nfv.dfFix(Bibliography, "Rural electricidad (%)", "Matrix of electricity generation") GD_Infrastructure = nt.concatDF(nt.concatDF(df1, df2), df3) nt.mkCSV(GD_Infrastructure, "GD_Infrastructure.csv") GD_ElectricGenerationMix = nfv.dfFix(Bibliography, "Hydropower (%)", "High voltage (kV)") nt.mkCSV(GD_ElectricGenerationMix, "GD_ElectricGenerationMix.csv") GD_ServiceAccess = nfv.dfFix(Bibliography, "Illiteracy rate (%)", "Shelter") nt.mkCSV(GD_ServiceAccess, "GD_ServiceAccess.csv") GD_Shelter = nfv.dfFix(Bibliography, "Slum population rate (%)", "SPECIFIC INFORMATION - SETTLEMENTS LEVEL") nt.mkCSV(GD_Shelter, "GD_Shelter.csv") Comun = pd.read_excel(nfv.getPath(nt.mainpath, "Bibliography_120220.xlsx")) Comun = nfv.fixBibliography(Comun) GD_Religion = nfv.dfFix(Comun, "Religion 1", "Language") df1 = nfv.dropRow(GD_Religion, 1) np_array1 = np.array(df1) df2 = nfv.dropRow(GD_Religion, 0) np_array2 = np.array(df2) np_array3 = np.concatenate((np_array1, np_array2), axis=1) GD_Religion = pd.DataFrame(np_array3) GD_Religion = GD_Religion.transpose() GD_Religion = GD_Religion[0].unique() GD_Religion = pd.DataFrame(GD_Religion) GD_Religion = GD_Religion.dropna() nt.mkCSV(GD_Religion, "GD_Religion.csv") GD_Language = nfv.dfFix(Comun, "Language 1", "Economy and well-being") df1 = nfv.dropRow(GD_Language, 1) np_array1 = np.array(df1) df2 = nfv.dropRow(GD_Language, 0) np_array2 = np.array(df2) np_array3 = np.concatenate((np_array1, np_array2), axis=1) GD_Language = pd.DataFrame(np_array3) GD_Language = GD_Language.transpose() GD_Language = GD_Language[0].unique() GD_Language = pd.DataFrame(GD_Language) GD_Language = GD_Language.dropna() nt.mkCSV(GD_Language, "GD_Language.csv")
def __init__(self, communityType): Bibliography = pd.read_excel( nfv.getPath(nfv.mainpath, "Bibliography_120220.xlsx")) Bibliography = nfv.fixBibliography(Bibliography) self.Bibliography = nfv.setDataByIndex(Bibliography, communityType) self.Entities = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_1_0_Entities_Interview_results.csv"), float_precision="high"), communityType) self.LocalLeaders = nfv.setDataByIndex( pd.read_csv(nfv.getPath(nfv.mainpath, "NAUTIA_1_0_Local_leaders_v3_results.csv"), float_precision="high"), communityType) self.HouseHold = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_1_0_Survey_household_v6_results.csv"), float_precision="high"), communityType) self.WomenGroup = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_1_0_Women_Focus_Group2_results.csv"), float_precision="high"), communityType) self.SanitationInfra = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_V1_0_Sanitation_Infrastructre_results.csv"), float_precision="high"), communityType) self.Priorities = nfv.setDataByIndex( pd.read_csv(nfv.getPath(nfv.mainpath, "NAUTIA_1_0_Priorities_v3_results.csv"), float_precision="high"), communityType) self.GeneralForm = nfv.setDataByIndex( pd.read_csv(nfv.getPath(nfv.mainpath, "NAUTIA_1_0_General_form_v3_results.csv"), float_precision="high"), communityType) self.PublicSpace = nfv.setDataByIndex( pd.read_csv(nfv.getPath(nfv.mainpath, "NAUTIA_1_0_Public_Space_results.csv"), float_precision="high"), communityType) self.WaterInf = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_1_0_Water_Infrastructure_results.csv"), float_precision="high"), communityType) self.SanitationInf = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_V1_0_Sanitation_Infrastructre_results.csv"), float_precision="high"), communityType) self.WasteManagementInf = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_1_0_Waste_Management_Infrastructure_results.csv"), float_precision="high"), communityType) self.EnergyINF = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_1_0_Energy_Infrastructure_results.csv"), float_precision="high"), communityType) self.Business = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA1_0_Business_surveys_v3_results.csv"), float_precision="high"), communityType) self.MobilityINF = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_1_0__Transport_servicesaccess_points_results.csv"), float_precision="high"), communityType) self.ComunalServices = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_1_0_Communal_Services_results.csv"), float_precision="high"), communityType) self.GeneralCitizen = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_1_0_General_Citizen_Focus_Group_results.csv"), float_precision="high"), communityType) self.Shelter = nfv.setDataByIndex( pd.read_csv(nfv.getPath(nfv.mainpath, "NAUTIA_1_0_Shelter_results.csv"), float_precision="high"), communityType) self.FarmyardCrop = nfv.setDataByIndex( pd.read_csv(nfv.getPath( nfv.mainpath, "NAUTIA_1_0_Farmyard_and_Crops_results.csv"), float_precision="high"), communityType)
nt.mkCSV(GD_Infrastructure, "GD_Infrastructure.csv") GD_ElectricGenerationMix = nfv.dfFix(Bibliography, "Hydropower (%)", "High voltage (kV)") nt.mkCSV(GD_ElectricGenerationMix, "GD_ElectricGenerationMix.csv") GD_ServiceAccess = nfv.dfFix(Bibliography, "Illiteracy rate (%)", "Shelter") nt.mkCSV(GD_ServiceAccess, "GD_ServiceAccess.csv") GD_Shelter = nfv.dfFix(Bibliography, "Slum population rate (%)", "SPECIFIC INFORMATION - SETTLEMENTS LEVEL") nt.mkCSV(GD_Shelter, "GD_Shelter.csv") #%%COMMUN DATA Comun = pd.read_excel(nfv.getPath(nt.mainpath, "Bibliography_120220.xlsx")) Comun = nfv.fixBibliography(Comun) GD_Religion = nfv.dfFix(Comun, "Religion 1", "Language") df1 = nfv.dfFix(GD_Religion, 1) np_array1 = np.array(df1) df2 = nfv.dfFix(GD_Religion, 0) np_array2 = np.array(df2) np_array3 = np.concatenate((np_array1, np_array2), axis=1) GD_Religion = pd.DataFrame(np_array3) GD_Religion = GD_Religion.transpose() GD_Religion = GD_Religion[0].unique() GD_Religion = pd.DataFrame(GD_Religion) GD_Religion = GD_Religion.dropna() nt.mkCSV(GD_Religion, "GD_Religion.csv") GD_Language = nfv.dfFix(Comun, "Language 1", "Economy and well-being")