pandas.
Series
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.
Contains data stored in Series. If data is a dict, argument order is maintained.
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 values in the index are used to reindex the Series after it is created using the keys in the data.
Data type for the output Series. If not specified, this will be inferred from data. See the user guide for more usages.
The name to give to the Series.
Copy input data.
Attributes
T
Return the transpose, which is by definition self.
array
The ExtensionArray of the data backing this Series or Index.
at
Access a single value for a row/column label pair.
attrs
Dictionary of global attributes of this dataset.
axes
Return a list of the row axis labels.
dtype
Return the dtype object of the underlying data.
dtypes
flags
Get the properties associated with this pandas object.
hasnans
Return if I have any nans; enables various perf speedups.
iat
Access a single value for a row/column pair by integer position.
iloc
Purely integer-location based indexing for selection by position.
index
The index (axis labels) of the Series.
is_monotonic
Return boolean if values in the object are monotonic_increasing.
is_monotonic_decreasing
Return boolean if values in the object are monotonic_decreasing.
is_monotonic_increasing
Alias for is_monotonic.
is_unique
Return boolean if values in the object are unique.
loc
Access a group of rows and columns by label(s) or a boolean array.
name
Return the name of the Series.
nbytes
Return the number of bytes in the underlying data.
ndim
Number of dimensions of the underlying data, by definition 1.
shape
Return a tuple of the shape of the underlying data.
size
Return the number of elements in the underlying data.
values
Return Series as ndarray or ndarray-like depending on the dtype.
empty
Methods
abs()
abs
Return a Series/DataFrame with absolute numeric value of each element.
add(other[, level, fill_value, axis])
add
Return Addition of series and other, element-wise (binary operator add).
add_prefix(prefix)
add_prefix
Prefix labels with string prefix.
add_suffix(suffix)
add_suffix
Suffix labels with string suffix.
agg([func, axis])
agg
Aggregate using one or more operations over the specified axis.
aggregate([func, axis])
aggregate
align(other[, join, axis, level, copy, …])
align
Align two objects on their axes with the specified join method.
all([axis, bool_only, skipna, level])
all
Return whether all elements are True, potentially over an axis.
any([axis, bool_only, skipna, level])
any
Return whether any element is True, potentially over an axis.
append(to_append[, ignore_index, …])
append
Concatenate two or more Series.
apply(func[, convert_dtype, args])
apply
Invoke function on values of Series.
argmax([axis, skipna])
argmax
Return int position of the largest value in the Series.
argmin([axis, skipna])
argmin
Return int position of the smallest value in the Series.
argsort([axis, kind, order])
argsort
Return the integer indices that would sort the Series values.
asfreq(freq[, method, how, normalize, …])
asfreq
Convert TimeSeries to specified frequency.
asof(where[, subset])
asof
Return the last row(s) without any NaNs before where.
astype(dtype[, copy, errors])
astype
Cast a pandas object to a specified dtype dtype.
at_time(time[, asof, axis])
at_time
Select values at particular time of day (e.g., 9:30AM).
autocorr([lag])
autocorr
Compute the lag-N autocorrelation.
backfill([axis, inplace, limit, downcast])
backfill
Synonym for DataFrame.fillna() with method='bfill'.
DataFrame.fillna()
method='bfill'
between(left, right[, inclusive])
between
Return boolean Series equivalent to left <= series <= right.
between_time(start_time, end_time[, …])
between_time
Select values between particular times of the day (e.g., 9:00-9:30 AM).
bfill([axis, inplace, limit, downcast])
bfill
bool()
bool
Return the bool of a single element Series or DataFrame.
cat
alias of pandas.core.arrays.categorical.CategoricalAccessor
pandas.core.arrays.categorical.CategoricalAccessor
clip([lower, upper, axis, inplace])
clip
Trim values at input threshold(s).
combine(other, func[, fill_value])
combine
Combine the Series with a Series or scalar according to func.
combine_first(other)
combine_first
Combine Series values, choosing the calling Series’s values first.
compare(other[, align_axis, keep_shape, …])
compare
Compare to another Series and show the differences.
convert_dtypes([infer_objects, …])
convert_dtypes
Convert columns to best possible dtypes using dtypes supporting pd.NA.
pd.NA
copy([deep])
copy
Make a copy of this object’s indices and data.
corr(other[, method, min_periods])
corr
Compute correlation with other Series, excluding missing values.
count([level])
count
Return number of non-NA/null observations in the Series.
cov(other[, min_periods, ddof])
cov
Compute covariance with Series, excluding missing values.
cummax([axis, skipna])
cummax
Return cumulative maximum over a DataFrame or Series axis.
cummin([axis, skipna])
cummin
Return cumulative minimum over a DataFrame or Series axis.
cumprod([axis, skipna])
cumprod
Return cumulative product over a DataFrame or Series axis.
cumsum([axis, skipna])
cumsum
Return cumulative sum over a DataFrame or Series axis.
describe([percentiles, include, exclude, …])
describe
Generate descriptive statistics.
diff([periods])
diff
First discrete difference of element.
div(other[, level, fill_value, axis])
div
Return Floating division of series and other, element-wise (binary operator truediv).
divide(other[, level, fill_value, axis])
divide
divmod(other[, level, fill_value, axis])
divmod
Return Integer division and modulo of series and other, element-wise (binary operator divmod).
dot(other)
dot
Compute the dot product between the Series and the columns of other.
drop([labels, axis, index, columns, level, …])
drop
Return Series with specified index labels removed.
drop_duplicates([keep, inplace])
drop_duplicates
Return Series with duplicate values removed.
droplevel(level[, axis])
droplevel
Return DataFrame with requested index / column level(s) removed.
dropna([axis, inplace, how])
dropna
Return a new Series with missing values removed.
dt
alias of pandas.core.indexes.accessors.CombinedDatetimelikeProperties
pandas.core.indexes.accessors.CombinedDatetimelikeProperties
duplicated([keep])
duplicated
Indicate duplicate Series values.
eq(other[, level, fill_value, axis])
eq
Return Equal to of series and other, element-wise (binary operator eq).
equals(other)
equals
Test whether two objects contain the same elements.
ewm([com, span, halflife, alpha, …])
ewm
Provide exponential weighted (EW) functions.
expanding([min_periods, center, axis])
expanding
Provide expanding transformations.
explode([ignore_index])
explode
Transform each element of a list-like to a row.
factorize([sort, na_sentinel])
factorize
Encode the object as an enumerated type or categorical variable.
ffill([axis, inplace, limit, downcast])
ffill
Synonym for DataFrame.fillna() with method='ffill'.
method='ffill'
fillna([value, method, axis, inplace, …])
fillna
Fill NA/NaN values using the specified method.
filter([items, like, regex, axis])
filter
Subset the dataframe rows or columns according to the specified index labels.
first(offset)
first
Select initial periods of time series data based on a date offset.
first_valid_index()
first_valid_index
Return index for first non-NA/null value.
floordiv(other[, level, fill_value, axis])
floordiv
Return Integer division of series and other, element-wise (binary operator floordiv).
ge(other[, level, fill_value, axis])
ge
Return Greater than or equal to of series and other, element-wise (binary operator ge).
get(key[, default])
get
Get item from object for given key (ex: DataFrame column).
groupby([by, axis, level, as_index, sort, …])
groupby
Group Series using a mapper or by a Series of columns.
gt(other[, level, fill_value, axis])
gt
Return Greater than of series and other, element-wise (binary operator gt).
head([n])
head
Return the first n rows.
hist([by, ax, grid, xlabelsize, xrot, …])
hist
Draw histogram of the input series using matplotlib.
idxmax([axis, skipna])
idxmax
Return the row label of the maximum value.
idxmin([axis, skipna])
idxmin
Return the row label of the minimum value.
infer_objects()
infer_objects
Attempt to infer better dtypes for object columns.
interpolate([method, axis, limit, inplace, …])
interpolate
Fill NaN values using an interpolation method.
isin(values)
isin
Whether elements in Series are contained in values.
isna()
isna
Detect missing values.
isnull()
isnull
item()
item
Return the first element of the underlying data as a Python scalar.
items()
items
Lazily iterate over (index, value) tuples.
iteritems()
iteritems
keys()
keys
Return alias for index.
kurt([axis, skipna, level, numeric_only])
kurt
Return unbiased kurtosis over requested axis.
kurtosis([axis, skipna, level, numeric_only])
kurtosis
last(offset)
last
Select final periods of time series data based on a date offset.
last_valid_index()
last_valid_index
Return index for last non-NA/null value.
le(other[, level, fill_value, axis])
le
Return Less than or equal to of series and other, element-wise (binary operator le).
lt(other[, level, fill_value, axis])
lt
Return Less than of series and other, element-wise (binary operator lt).
mad([axis, skipna, level])
mad
Return the mean absolute deviation of the values over the requested axis.
map(arg[, na_action])
map
Map values of Series according to input correspondence.
mask(cond[, other, inplace, axis, level, …])
mask
Replace values where the condition is True.
max([axis, skipna, level, numeric_only])
max
Return the maximum of the values over the requested axis.
mean([axis, skipna, level, numeric_only])
mean
Return the mean of the values over the requested axis.
median([axis, skipna, level, numeric_only])
median
Return the median of the values over the requested axis.
memory_usage([index, deep])
memory_usage
Return the memory usage of the Series.
min([axis, skipna, level, numeric_only])
min
Return the minimum of the values over the requested axis.
mod(other[, level, fill_value, axis])
mod
Return Modulo of series and other, element-wise (binary operator mod).
mode([dropna])
mode
Return the mode(s) of the Series.
mul(other[, level, fill_value, axis])
mul
Return Multiplication of series and other, element-wise (binary operator mul).
multiply(other[, level, fill_value, axis])
multiply
ne(other[, level, fill_value, axis])
ne
Return Not equal to of series and other, element-wise (binary operator ne).
nlargest([n, keep])
nlargest
Return the largest n elements.
notna()
notna
Detect existing (non-missing) values.
notnull()
notnull
nsmallest([n, keep])
nsmallest
Return the smallest n elements.
nunique([dropna])
nunique
Return number of unique elements in the object.
pad([axis, inplace, limit, downcast])
pad
pct_change([periods, fill_method, limit, freq])
pct_change
Percentage change between the current and a prior element.
pipe(func, *args, **kwargs)
pipe
Apply func(self, *args, **kwargs).
plot
alias of pandas.plotting._core.PlotAccessor
pandas.plotting._core.PlotAccessor
pop(item)
pop
Return item and drops from series.
pow(other[, level, fill_value, axis])
pow
Return Exponential power of series and other, element-wise (binary operator pow).
prod([axis, skipna, level, numeric_only, …])
prod
Return the product of the values over the requested axis.
product([axis, skipna, level, numeric_only, …])
product
quantile([q, interpolation])
quantile
Return value at the given quantile.
radd(other[, level, fill_value, axis])
radd
Return Addition of series and other, element-wise (binary operator radd).
rank([axis, method, numeric_only, …])
rank
Compute numerical data ranks (1 through n) along axis.
ravel([order])
ravel
Return the flattened underlying data as an ndarray.
rdiv(other[, level, fill_value, axis])
rdiv
Return Floating division of series and other, element-wise (binary operator rtruediv).
rdivmod(other[, level, fill_value, axis])
rdivmod
Return Integer division and modulo of series and other, element-wise (binary operator rdivmod).
reindex([index])
reindex
Conform Series to new index with optional filling logic.
reindex_like(other[, method, copy, limit, …])
reindex_like
Return an object with matching indices as other object.
rename([index, axis, copy, inplace, level, …])
rename
Alter Series index labels or name.
rename_axis([mapper, index, columns, axis, …])
rename_axis
Set the name of the axis for the index or columns.
reorder_levels(order)
reorder_levels
Rearrange index levels using input order.
repeat(repeats[, axis])
repeat
Repeat elements of a Series.
replace([to_replace, value, inplace, limit, …])
replace
Replace values given in to_replace with value.
resample(rule[, axis, closed, label, …])
resample
Resample time-series data.
reset_index([level, drop, name, inplace])
reset_index
Generate a new DataFrame or Series with the index reset.
rfloordiv(other[, level, fill_value, axis])
rfloordiv
Return Integer division of series and other, element-wise (binary operator rfloordiv).
rmod(other[, level, fill_value, axis])
rmod
Return Modulo of series and other, element-wise (binary operator rmod).
rmul(other[, level, fill_value, axis])
rmul
Return Multiplication of series and other, element-wise (binary operator rmul).
rolling(window[, min_periods, center, …])
rolling
Provide rolling window calculations.
round([decimals])
round
Round each value in a Series to the given number of decimals.
rpow(other[, level, fill_value, axis])
rpow
Return Exponential power of series and other, element-wise (binary operator rpow).
rsub(other[, level, fill_value, axis])
rsub
Return Subtraction of series and other, element-wise (binary operator rsub).
rtruediv(other[, level, fill_value, axis])
rtruediv
sample([n, frac, replace, weights, …])
sample
Return a random sample of items from an axis of object.
searchsorted(value[, side, sorter])
searchsorted
Find indices where elements should be inserted to maintain order.
sem([axis, skipna, level, ddof, numeric_only])
sem
Return unbiased standard error of the mean over requested axis.
set_axis(labels[, axis, inplace])
set_axis
Assign desired index to given axis.
set_flags(*[, copy, allows_duplicate_labels])
set_flags
Return a new object with updated flags.
shift([periods, freq, axis, fill_value])
shift
Shift index by desired number of periods with an optional time freq.
skew([axis, skipna, level, numeric_only])
skew
Return unbiased skew over requested axis.
slice_shift([periods, axis])
slice_shift
(DEPRECATED) Equivalent to shift without copying data.
sort_index([axis, level, ascending, …])
sort_index
Sort Series by index labels.
sort_values([axis, ascending, inplace, …])
sort_values
Sort by the values.
sparse
alias of pandas.core.arrays.sparse.accessor.SparseAccessor
pandas.core.arrays.sparse.accessor.SparseAccessor
squeeze([axis])
squeeze
Squeeze 1 dimensional axis objects into scalars.
std([axis, skipna, level, ddof, numeric_only])
std
Return sample standard deviation over requested axis.
str
alias of pandas.core.strings.accessor.StringMethods
pandas.core.strings.accessor.StringMethods
sub(other[, level, fill_value, axis])
sub
Return Subtraction of series and other, element-wise (binary operator sub).
subtract(other[, level, fill_value, axis])
subtract
sum([axis, skipna, level, numeric_only, …])
sum
Return the sum of the values over the requested axis.
swapaxes(axis1, axis2[, copy])
swapaxes
Interchange axes and swap values axes appropriately.
swaplevel([i, j, copy])
swaplevel
Swap levels i and j in a MultiIndex.
MultiIndex
tail([n])
tail
Return the last n rows.
take(indices[, axis, is_copy])
take
Return the elements in the given positional indices along an axis.
to_clipboard([excel, sep])
to_clipboard
Copy object to the system clipboard.
to_csv([path_or_buf, sep, na_rep, …])
to_csv
Write object to a comma-separated values (csv) file.
to_dict([into])
to_dict
Convert Series to {label -> value} dict or dict-like object.
to_excel(excel_writer[, sheet_name, na_rep, …])
to_excel
Write object to an Excel sheet.
to_frame([name])
to_frame
Convert Series to DataFrame.
to_hdf(path_or_buf, key[, mode, complevel, …])
to_hdf
Write the contained data to an HDF5 file using HDFStore.
to_json([path_or_buf, orient, date_format, …])
to_json
Convert the object to a JSON string.
to_latex([buf, columns, col_space, header, …])
to_latex
Render object to a LaTeX tabular, longtable, or nested table/tabular.
to_list()
to_list
Return a list of the values.
to_markdown([buf, mode, index, storage_options])
to_markdown
Print Series in Markdown-friendly format.
to_numpy([dtype, copy, na_value])
to_numpy
A NumPy ndarray representing the values in this Series or Index.
to_period([freq, copy])
to_period
Convert Series from DatetimeIndex to PeriodIndex.
to_pickle(path[, compression, protocol, …])
to_pickle
Pickle (serialize) object to file.
to_sql(name, con[, schema, if_exists, …])
to_sql
Write records stored in a DataFrame to a SQL database.
to_string([buf, na_rep, float_format, …])
to_string
Render a string representation of the Series.
to_timestamp([freq, how, copy])
to_timestamp
Cast to DatetimeIndex of Timestamps, at beginning of period.
to_xarray()
to_xarray
Return an xarray object from the pandas object.
tolist()
tolist
transform(func[, axis])
transform
Call func on self producing a Series with transformed values.
func
transpose(*args, **kwargs)
transpose
truediv(other[, level, fill_value, axis])
truediv
truncate([before, after, axis, copy])
truncate
Truncate a Series or DataFrame before and after some index value.
tshift([periods, freq, axis])
tshift
(DEPRECATED) Shift the time index, using the index’s frequency if available.
tz_convert(tz[, axis, level, copy])
tz_convert
Convert tz-aware axis to target time zone.
tz_localize(tz[, axis, level, copy, …])
tz_localize
Localize tz-naive index of a Series or DataFrame to target time zone.
unique()
unique
Return unique values of Series object.
unstack([level, fill_value])
unstack
Unstack, also known as pivot, Series with MultiIndex to produce DataFrame.
update(other)
update
Modify Series in place using values from passed Series.
value_counts([normalize, sort, ascending, …])
value_counts
Return a Series containing counts of unique values.
var([axis, skipna, level, ddof, numeric_only])
var
Return unbiased variance over requested axis.
view([dtype])
view
Create a new view of the Series.
where(cond[, other, inplace, axis, level, …])
where
Replace values where the condition is False.
xs(key[, axis, level, drop_level])
xs
Return cross-section from the Series/DataFrame.