|
Size: 2380
Comment: Initial commit
|
← Revision 17 as of 2025-12-23 05:06:57 ⇥
Size: 0
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| = Python Pandas Series = A '''`Series`''' is an ordered collection of somewhat-uniform data that can be indexed. <<TableOfContents>> ---- == Example == {{{ import pandas as pd pd.Series(["foo", "bar", "baz"]) # 0 foo # 1 bar # 2 baz # dtype: object }}} ---- == Data Model == A `Series` can be instantiated with any [[Python/Collections/Abc#Iterable|iterable]]. === Index === By default, a series is indexed by a sequential integer (beginning at 0). Certain iterables are interpreted as pairs of indices and values. {{{ d = {"First": "foo", "Second": "bar", "Third": "baz"} s = pd.Series(d) # First foo # Second bar # Third baz # dtype: object }}} A second iterable can be specified as explicit indices. {{{ d = ["foo", "bar", "baz"] i = ["First", "Second", "Third"] s = pd.Series(d, i) s = pd.Series(d, index=i) s = pd.Series(data=d, index=i) }}} === DType === A series without significant consistency of data types with initialize with a '''dtype''' of `object`. Alternatives include: * `int64` * `float64` * `datetime64` * `bool` * `category` ---- == Attributes == ||'''Method'''||'''Meaning''' || ||`index` ||[[Python/Pandas/Types|RangeIndex]] containing the member indices || ||`is_unique` ||[[Python/Builtins/Types#Bool|bool]] representing if all member values are unique|| ||`size` ||[[Python/Builtins/Types#Int|int]] count of member values || ||`values` ||[[Python/NumPy/Types|numpy.ndarray]] containing the member values || ---- == Methods == These methods return [[Python/NumPy/Types|numpy.float64]] values unless otherwise specified. ||'''Method'''||'''Meaning''' || ||`mean` ||return mean value || ||`product` ||return product from multiplying all member values|| ||`std` ||return standard deviation of values || ||`sum` ||return sum from adding all member values || ---- CategoryRicottone |
