Jan-08-2023, 04:52 AM
(This post was last modified: Jan-08-2023, 05:16 PM by deanhystad.)
There error is correct. There is no variable or function named index, nor is
[python]import pandas as pd
my_ser = pd.Series([1, 2, 3, 4], index=['A', 'B', 'C', 'D'])
index is an optional argument when you create a Series. index=['A', 'B', 'C', 'D'] is treating index as a named argument and passing the value ['A', 'B', 'C', 'D'].
index['A', 'B', 'C', 'D"]
valid for any kind of python I know about. [python]import pandas as pd
my_ser = pd.Series([1, 2, 3, 4], index=['A', 'B', 'C', 'D'])
index is an optional argument when you create a Series. index=['A', 'B', 'C', 'D'] is treating index as a named argument and passing the value ['A', 'B', 'C', 'D'].