Generation

generate functionFri, 24 Feb 2023

There is a Pandas dataframe: spi_rank country spi_score basic_human_needs foundations_of_wellbeing opportunity basic_nutri_med_care water_sanitation shelter personal_safety access_to_knowledge access_to_communications health_wellness environmental_quality personal_rights personal_freedom inclusiveness access_to_advanced_education 61 62.0 Russia 73.45 83.0 79.4 57.94 95.49 97.04 88.56 50.92 94.34 77.42 64.7 81.16 51.79 70.26 30.31 79.4 Write a function that converts dataframe columns to rows

def columns_to_rows(dataframe): new_dataframe = pd.DataFrame(dataframe.loc[0]).T return new_dataframe

Questions about programming?Chat with your personal AI assistant