0

I want to create dictionary data set but getting error

please solve this eeeor

3rd Sep 2021, 6:17 AM
Siva Kumar YARRAMSETTI
Siva Kumar YARRAMSETTI - avatar
3 Respuestas
+ 1
data={ "GOOGLE" : {"COMPANY" , "SHAREPRICE" : 276.38} } ^ The program is getting hung up on the colon after "SHAREPRICE". It almost looks like data is trying to have a dictionary within a dictionary. I believe what you're trying to do is this: data={ "COMPANY" : "GOOGLE" , "SHAREPRICE" : 276.38} I'm also not sure why you want your index to be the columns, but we live in a free country, so you do you.
3rd Sep 2021, 6:46 AM
Josiah Mathieu
Josiah Mathieu - avatar
0
import pandas as pd data={ "GOOGLE" : {"COMPANY" , "SHAREPRICE" : 276.38} } columns=('COMPANY' , 'SHAREPRICE') df=pd.DataFrame(data , index=columns) df
3rd Sep 2021, 6:19 AM
Siva Kumar YARRAMSETTI
Siva Kumar YARRAMSETTI - avatar
0
I'm getting syntax error
3rd Sep 2021, 6:19 AM
Siva Kumar YARRAMSETTI
Siva Kumar YARRAMSETTI - avatar