Module « pandas »
Classe « Series »
Informations générales
Héritage
builtins.object
IndexingMixin
builtins.object
SelectionMixin
builtins.object
DirNamesMixin
PandasObject
NDFrame
builtins.object
OpsMixin
IndexOpsMixin
Series
Définition
class Series(IndexOpsMixin, NDFrame):
Description [extrait de Series.__doc__]
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 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 `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 `data`.
See the :ref:`user guide <basics.dtypes>` for more usages.
name : str, optional
The name to give to the Series.
copy : bool, default False
Copy input data.
Examples
--------
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
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.
Constructeur(s)
Liste des attributs statiques
index | <pandas._libs.properties.AxisProperty object at 0x7f504a7a5cd0> |
Attributs statiques hérités de la classe SelectionMixin
ndim
Attributs statiques hérités de la classe IndexOpsMixin
hasnans
Liste des propriétés
array | |
at | |
attrs | |
axes | |
dtype | |
dtypes | |
empty | |
flags | |
hasnans | |
iat | |
iloc | |
is_monotonic | |
is_monotonic_decreasing | |
is_monotonic_increasing | |
is_unique | |
loc | |
name | |
nbytes | |
ndim | |
shape | |
size | |
T | |
values | |
Opérateurs hérités de la classe NDFrame
__contains__, __delitem__, __iadd__, __iand__, __ifloordiv__, __imod__, __imul__, __invert__, __ior__, __ipow__, __isub__, __itruediv__, __ixor__, __neg__, __pos__
Opérateurs hérités de la classe OpsMixin
__add__, __and__, __eq__, __floordiv__, __ge__, __gt__, __le__, __lt__, __mod__, __mul__, __ne__, __or__, __pow__, __radd__, __rand__, __rfloordiv__, __rmod__, __rmul__, __ror__, __rpow__, __rsub__, __rtruediv__, __rxor__, __sub__, __truediv__, __xor__
Liste des méthodes
Toutes les méthodes
Méthodes d'instance
Méthodes statiques
Méthodes dépréciées
__array__(self, dtype=None) -> numpy.ndarray |
|
__len__(self) -> int |
|
__repr__(self) -> str |
|
__rmatmul__(self, other) |
|
agg(self, func=None, axis=0, *args, **kwargs) |
|
aggregate(self, func=None, axis=0, *args, **kwargs) |
|
align(self, other, join='outer', axis=None, level=None, copy=True, fill_value=None, method=None, limit=None, fill_axis=0, broadcast_axis=None) |
|
append(self, to_append, ignore_index=False, verify_integrity=False) |
|
apply(self, func, convert_dtype=True, args=(), **kwds) |
|
argsort(self, axis=0, kind='quicksort', order=None) -> 'Series' |
|
autocorr(self, lag=1) -> float |
|
between(self, left, right, inclusive=True) -> 'Series' |
|
combine(self, other, func, fill_value=None) -> 'Series' |
|
combine_first(self, other) -> 'Series' |
|
compare(self, other: 'Series', align_axis: Union[str, int] = 1, keep_shape: bool = False, keep_equal: bool = False) -> Union[ForwardRef('DataFrame'), ForwardRef('Series')] |
|
corr(self, other, method='pearson', min_periods=None) -> float |
|
count(self, level=None) |
|
cov(self, other: 'Series', min_periods: Optional[int] = None, ddof: Optional[int] = 1) -> float |
|
diff(self, periods: int = 1) -> 'Series' |
|
dot(self, other) |
|
drop(self, labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors='raise') -> 'Series' |
|
drop_duplicates(self, keep='first', inplace=False) -> Optional[ForwardRef('Series')] |
|
dropna(self, axis=0, inplace=False, how=None) |
|
duplicated(self, keep='first') -> 'Series' |
|
explode(self, ignore_index: bool = False) -> 'Series' |
|
fillna(self, value=None, method=None, axis=None, inplace=False, limit=None, downcast=None) -> Optional[ForwardRef('Series')] |
|
groupby(self, by=None, axis=0, level=None, as_index: bool = True, sort: bool = True, group_keys: bool = True, squeeze: bool = <object object at 0x7f5051439e10>, observed: bool = False, dropna: bool = True) -> 'SeriesGroupBy' |
|
idxmax(self, axis=0, skipna=True, *args, **kwargs) |
|
idxmin(self, axis=0, skipna=True, *args, **kwargs) |
|
isin(self, values) -> 'Series' |
|
isna(self) -> 'Series' |
|
isnull(self) -> 'Series' |
|
items(self) -> Iterable[Tuple[Optional[Hashable], Any]] |
|
iteritems(self) -> Iterable[Tuple[Optional[Hashable], Any]] |
|
keys(self) -> pandas.core.indexes.base.Index |
|
map(self, arg, na_action=None) -> 'Series' |
|
memory_usage(self, index=True, deep=False) |
|
mode(self, dropna=True) -> 'Series' |
|
nlargest(self, n=5, keep='first') -> 'Series' |
|
notna(self) -> 'Series' |
|
notnull(self) -> 'Series' |
|
nsmallest(self, n=5, keep='first') -> 'Series' |
|
pop(self, item: Optional[Hashable]) -> Any |
|
quantile(self, q=0.5, interpolation='linear') |
|
ravel(self, order='C') |
|
reindex(self, index=None, **kwargs) |
|
rename(self, index=None, *, axis=None, copy=True, inplace=False, level=None, errors='ignore') |
|
reorder_levels(self, order) -> 'Series' |
|
repeat(self, repeats, axis=None) -> 'Series' |
|
replace(self, to_replace=None, value=None, inplace=False, limit=None, regex=False, method='pad') |
|
reset_index(self, level=None, drop=False, name=None, inplace=False) |
|
round(self, decimals=0, *args, **kwargs) -> 'Series' |
|
searchsorted(self, value, side='left', sorter=None) |
|
set_axis(self, labels, axis: Union[str, int] = 0, inplace: bool = False) |
|
shift(self, periods=1, freq=None, axis=0, fill_value=None) -> 'Series' |
|
sort_index(self, axis=0, level=None, ascending: Union[bool, int, Sequence[Union[bool, int]]] = True, inplace: bool = False, kind: str = 'quicksort', na_position: str = 'last', sort_remaining: bool = True, ignore_index: bool = False, key: Optional[Callable[[ForwardRef('Index')], Union[ForwardRef('Index'), ~AnyArrayLike]]] = None) |
|
sort_values(self, axis=0, ascending: Union[bool, int, Sequence[Union[bool, int]]] = True, inplace: bool = False, kind: str = 'quicksort', na_position: str = 'last', ignore_index: bool = False, key: Optional[Callable[[ForwardRef('Series')], Union[ForwardRef('Series'), ~AnyArrayLike]]] = None) |
|
swaplevel(self, i=-2, j=-1, copy=True) -> 'Series' |
|
take(self, indices, axis=0, is_copy=None, **kwargs) -> 'Series' |
|
to_dict(self, into=<class 'dict'>) |
|
to_frame(self, name=None) -> 'DataFrame' |
|
to_markdown(self, buf: Optional[IO[str]] = None, mode: str = 'wt', index: bool = True, storage_options: Optional[Dict[str, Any]] = None, **kwargs) -> Optional[str] |
|
to_period(self, freq=None, copy=True) -> 'Series' |
|
to_string(self, buf=None, na_rep='NaN', float_format=None, header=True, index=True, length=False, dtype=False, name=False, max_rows=None, min_rows=None) |
|
to_timestamp(self, freq=None, how='start', copy=True) -> 'Series' |
|
transform(self, func: Union[Callable, str, List[Union[Callable, str]], Dict[Optional[Hashable], Union[Callable, str, List[Union[Callable, str]]]]], axis: Union[str, int] = 0, *args, **kwargs) -> Union[ForwardRef('DataFrame'), ForwardRef('Series')] |
|
unique(self) |
|
unstack(self, level=-1, fill_value=None) |
|
update(self, other) -> None |
|
view(self, dtype=None) -> 'Series' |
|
Méthodes héritées de la classe NDFrame
__abs__, __array_ufunc__, __array_wrap__, __bool__, __copy__, __deepcopy__, __finalize__, __getattr__, __getstate__, __hash__, __init_subclass__, __iter__, __nonzero__, __round__, __setattr__, __setstate__, __subclasshook__, abs, add_prefix, add_suffix, all, any, asfreq, asof, astype, at_time, backfill, between_time, bfill, bool, clip, convert_dtypes, copy, cummax, cummin, cumprod, cumsum, describe, droplevel, equals, ewm, expanding, ffill, filter, first, first_valid_index, get, head, infer_objects, interpolate, kurt, kurtosis, last, last_valid_index, mad, mask, max, mean, median, min, pad, pct_change, pipe, prod, product, rank, reindex_like, rename_axis, resample, rolling, sample, sem, set_flags, skew, slice_shift, squeeze, std, sum, swapaxes, tail, to_clipboard, to_csv, to_excel, to_hdf, to_json, to_latex, to_pickle, to_sql, to_xarray, truncate, tshift, tz_convert, tz_localize, var, where, xs
Méthodes héritées de la classe PandasObject
__sizeof__
Méthodes héritées de la classe DirNamesMixin
__dir__
Méthodes héritées de la classe IndexOpsMixin
argmax, argmin, factorize, item, nunique, to_list, to_numpy, tolist, transpose, value_counts
Méthodes héritées de la classe OpsMixin
__divmod__, __rdivmod__
Méthodes héritées de la classe object
__delattr__,
__format__,
__getattribute__,
__reduce__,
__reduce_ex__,
__str__
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :