One-dimensional ndarray with axis labels (including time series). 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
| 232 | # definition in base class "NDFrame" |
| 233 | @set_module("pandas") |
| 234 | class Series(base.IndexOpsMixin, NDFrame): # type: ignore[misc] |
| 235 | """ |
| 236 | One-dimensional ndarray with axis labels (including time series). |
| 237 | |
| 238 | Labels need not be unique but must be a hashable type. The object |
| 239 | supports both integer- and label-based indexing and provides a host of |
| 240 | methods for performing operations involving the index. Statistical |
| 241 | methods from ndarray have been overridden to automatically exclude |
| 242 | missing data (currently represented as NaN). |
| 243 | |
| 244 | Operations between Series (+, -, /, \\*, \\*\\*) align values based on their |
| 245 | associated index values-- they need not be the same length. The result |
| 246 | index will be the sorted union of the two indexes. |
| 247 | |
| 248 | Parameters |
| 249 | ---------- |
| 250 | data : array-like, Iterable, dict, or scalar value |
| 251 | Contains data stored in Series. If data is a dict, argument order is |
| 252 | maintained. Unordered sets are not supported. |
| 253 | index : array-like or Index (1d) |
| 254 | Values must be hashable and have the same length as `data`. |
| 255 | Non-unique index values are allowed. Will default to |
| 256 | RangeIndex (0, 1, 2, ..., n) if not provided. If data is dict-like |
| 257 | and index is None, then the keys in the data are used as the index. If the |
| 258 | index is not None, the resulting Series is reindexed with the index values. |
| 259 | dtype : str, numpy.dtype, or ExtensionDtype, optional |
| 260 | Data type for the output Series. If not specified, this will be |
| 261 | inferred from `data`. |
| 262 | See the :ref:`user guide <basics.dtypes>` for more usages. |
| 263 | name : Hashable, default None |
| 264 | The name to give to the Series. |
| 265 | copy : bool, default None |
| 266 | Whether to copy input data, only relevant for array, Series, and Index |
| 267 | inputs (for other input, e.g. a list, a new array is created anyway). |
| 268 | Defaults to True for array input and False for Index/Series. |
| 269 | Even when False for Index/Series, a shallow copy of the data is made. |
| 270 | Set to False to avoid copying array input at your own risk (if you |
| 271 | know the input data won't be modified elsewhere). |
| 272 | Set to True to force copying Series/Index input up front. |
| 273 | |
| 274 | See Also |
| 275 | -------- |
| 276 | DataFrame : Two-dimensional, size-mutable, potentially heterogeneous tabular data. |
| 277 | Index : Immutable sequence used for indexing and alignment. |
| 278 | |
| 279 | Notes |
| 280 | ----- |
| 281 | Please reference the :ref:`User Guide <basics.series>` for more information. |
| 282 | |
| 283 | Examples |
| 284 | -------- |
| 285 | Constructing Series from a dictionary with an Index specified |
| 286 | |
| 287 | >>> d = {"a": 1, "b": 2, "c": 3} |
| 288 | >>> ser = pd.Series(data=d, index=["a", "b", "c"]) |
| 289 | >>> ser |
| 290 | a 1 |
| 291 | b 2 |