Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a dataset of covid total case total death and country name. I want add all details of total case,death and country name in world map using folium library and using popmarker, but it is showing "positional argument follows keyword argument "

sorry I explained badly

What I have tried:

data = pd.read_csv("covid_data.csv")
data.head()


its is my data set but sorry i dont know how copy output of jupyternotebook

	Country	City	Country_Population	Total_Day_Lockdown	Avg_Pollution_2020	Avg_Pollution_2019	Development	Total_Case	Total_Death	Latitude	Longitude	Change
0	United Arab Emirates	Dubai	9890400	23	86.0	95	1	22627	214	23.424076	53.847818	1
1	Argentina	Buenos Aires	45195777	60	35.9	35	0	7792	363	-38.416097	-63.616672	0
2	Austria	Vienna	9006400	29	44.0	50	1	16140	628	47.516231	14.550072	1
3	Australia	Melbourne	25499881	56	31.0	28	1	7036	98	-25.274398	133.775136	0
4	Bangladesh	Dhaka	25499881	31	175.0	210	0	7036	98	23.684994	90.356331	1
data.shape







m = folium.Map(location=[20,0], tiles="OpenStreetMap", zoom_start=2)
for i in range(0,len(data)): 
 folium.Marker(
      location=[data.iloc[i]['Latitude'], data.iloc[i]['Longitude']],
      popup=data.iloc[i]['Total_Case'], +' ' + data.iloc[i]['Total_Death'] +' ' + data.iloc[i][ 'Country'],
       ).add_to(m)
# Show the map again
m


it is showing output like this

 File "C:\Users\darshan\AppData\Local\Temp/ipykernel_18052/1964259780.py", line 6
    ).add_to(m)
    ^
SyntaxError: positional argument follows keyword argument


sorry for telling problem badly sorry I'm not good at English
Posted
Updated 19-Apr-22 0:40am

1 solution

You have positional parameters after a keyword parameter which is invalid:
Python
folium.Marker(
     location=[data.iloc[i]['Latitude'], data.iloc[i]['Longitude']],
     popup=data.iloc[i]['Total_Case'], +' ' + data.iloc[i]['Total_Death'] +' ' + data.iloc[i][ 'Country'],
     #                               ^ positional parameters are not allowed from here
      ).add_to(m)
 
Share this answer
 
v3
Comments
darshanbs-wq 19-Apr-22 7:12am    
Thank you, sir, for your answer but it is showing the same error
Richard MacCutchan 19-Apr-22 7:17am    
Sorry, I missed the other commas in your code. You must move the positional parameters to the correct place in the function call, and before the keyword one, which is location=[data.iloc[i]['Latitude']. Check the documentation for the folium.marker function call.
darshanbs-wq 19-Apr-22 7:34am    
ok sir

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900