A Pandas Series holds data in a single column with an associated index, making it one-dimensional. It is like a list with labels.
import pandas as pd s = pd.Series([10, 20, 30, 40]) print(s.shape)
The shape of a Series is a tuple with one element showing the number of rows, e.g., (4,). This confirms it is 1D.
import pandas as pd s = pd.Series([5, 10, 15], index=['a', 'b', 'c']) print(s.index) print(s.values)
The index is a pandas Index object showing labels, and values is a numpy array of the data.
import pandas as pd s = pd.Series([1, 2, 3]) print(s[0,1])
Series indexing expects a single key. Using a tuple (0,1) as key causes a KeyError because that key does not exist.
import pandas as pd dates = pd.date_range('2024-06-01', periods=7) temps = pd.Series([22, 23, 21, 20, 19, 18, 17], index=dates)
temps.loc['2024-06-03'] selects the value by label (date). temps['2024-06-03'] also works but can be ambiguous. iloc expects integer position, so option A is wrong. temps[3] selects by position, not date.
