The following code is giving me some unexpected output. In summary, I am defining a Dictionary (dict2) and then creating a series out of it. Then, I am re-assigning a new value to the Math course and the Science course using the Series' method. Only the value for Science changes (and for Math it is unchanged). Can you please help me understand why? Thank you.
Edit: My goal is to understand why this is not working as expected, rather than actually reassigning a value to Math. I've also added the code here instead of the screenshot. Thank you.
dict2 = {'Maths': 60, 'Science': 89, 'English': 76, 'Social Science': 86}
marks_series = pd.Series(dict2)
print(marks_series)
marks_series.Maths = 65
marks_series.Science = 90
print (marks_series)
CodePudding user response:
I restarted my notebook and that fixed the issue. I still wonder why it happened in the first place. But that's for another day.
CodePudding user response:
According to replays and info , your code working correctly and the problem may be case of importing pandas and your Env