-
-
Save amankharwal/8afd50c64dac57932feb93331995fe51 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
world = pd.DataFrame({"Country":[],"Cases":[]}) | |
world["Country"] = df0.iloc[:,1:].columns | |
cases = [] | |
for i in world["Country"]: | |
cases.append(pd.to_numeric(df0[i][1:]).sum()) | |
world["Cases"]=cases | |
country_list=list(world["Country"].values) | |
idx = 0 | |
for i in country_list: | |
sayac = 0 | |
for j in i: | |
if j==".": | |
i = i[:sayac] | |
country_list[idx]=i | |
elif j=="(": | |
i = i[:sayac-1] | |
country_list[idx]=i | |
else: | |
sayac += 1 | |
idx += 1 | |
world["Country"]=country_list | |
world = world.groupby("Country")["Cases"].sum().reset_index() | |
world.head() | |
continent=pd.read_csv("continents2.csv") | |
continent["name"]=continent["name"].str.upper() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment