pandas 1.4.2

ParametersBackRef

Labels need not be unique but must be a hashable type. The object supports both integer- and label-based indexing and provides a host of methods for performing operations involving the index. Statistical methods from ndarray have been overridden to automatically exclude missing data (currently represented as NaN).

Operations between Series (+, -, /, \*, \*\*) align values based on their associated index values-- they need not be the same length. The result index will be the sorted union of the two indexes.

Parameters

data : array-like, Iterable, dict, or scalar value

Contains data stored in Series. If data is a dict, argument order is maintained.

index : array-like or Index (1d)

Values must be hashable and have the same length as :None:None:`data`. Non-unique index values are allowed. Will default to RangeIndex (0, 1, 2, ..., n) if not provided. If data is dict-like and index is None, then the keys in the data are used as the index. If the index is not None, the resulting Series is reindexed with the index values.

dtype : str, numpy.dtype, or ExtensionDtype, optional

Data type for the output Series. If not specified, this will be inferred from :None:None:`data`. See the user guide <basics.dtypes> for more usages.

name : str, optional

The name to give to the Series.

copy : bool, default False

Copy input data. Only affects Series or 1d ndarray input. See examples.

One-dimensional ndarray with axis labels (including time series).

Examples

Constructing Series from a dictionary with an Index specified

This example is valid syntax, but we were not able to check execution
>>> 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.

This example is valid syntax, but we were not able to check execution
>>> d = {'a': 1, 'b': 2, 'c': 3}
... ser = pd.Series(data=d, index=['x', 'y', 'z'])
... ser x NaN y NaN z NaN dtype: float64

Note that the Index is first build with the keys from the dictionary. After this the Series is reindexed with the given Index values, hence we get all NaN as a result.

Constructing Series from a list with :None:None:`copy=False`.

This example is valid syntax, but we were not able to check execution
>>> r = [1, 2]
... ser = pd.Series(r, copy=False)
... ser.iloc[0] = 999
... r [1, 2]
This example is valid syntax, but we were not able to check execution
>>> ser
0    999
1      2
dtype: int64

Due to input data type the Series has a copy of the original data even though :None:None:`copy=False`, so the data is unchanged.

Constructing Series from a 1d ndarray with :None:None:`copy=False`.

This example is valid syntax, but we were not able to check execution
>>> r = np.array([1, 2])
... ser = pd.Series(r, copy=False)
... ser.iloc[0] = 999
... r array([999, 2])
This example is valid syntax, but we were not able to check execution
>>> ser
0    999
1      2
dtype: int64

Due to input data type the Series has a :None:None:`view` on the original data, so the data is changed as well.

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.series.Series.reset_index pandas.core.tools.numeric.to_numeric pandas.plotting pandas.core.frame.DataFrame.resample pandas.core.series.Series.combine pandas pandas.core.dtypes.concat.union_categoricals pandas.plotting._misc.radviz pandas.core.series.Series.resample pandas.core.construction.array pandas.core.reshape.tile.cut pandas.core.generic.NDFrame.resample pandas.core.frame.DataFrame.insert pandas.io.formats.format.get_series_repr_params matplotlib.cbook.index_of

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/series.py#201
type: <class 'type'>
Commit: