Skip to content
Prev Previous commit
Next Next commit
Add example with matching index
  • Loading branch information
phofl committed Feb 6, 2021
commit ef3db61f37aa1322b0c323c85c8633a078960ba9
11 changes: 11 additions & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
--------
Constructing Series from a dictionary with an Index specified

>>> d = {'a': 1, 'b': 2, 'c': 3}
>>> ser = pd.Series(data=d, index=['a', 'b', 'c'])
>>> ser
a 1
b 2
c 3
dtype: int64

The keys of the dictionary match with the Index values, hence the Index
values have no effect.

>>> d = {'a': 1, 'b': 2, 'c': 3}
>>> ser = pd.Series(data=d, index=['x', 'y', 'z'])
>>> ser
Expand Down