Python series изменить значения индекса

Series#

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

Attributes#

The index (axis labels) of the Series.

The ExtensionArray of the data backing this Series or Index.

Return Series as ndarray or ndarray-like depending on the dtype.

Return the dtype object of the underlying data.

Return a tuple of the shape of the underlying data.

Return the number of bytes in the underlying data.

Number of dimensions of the underlying data, by definition 1.

Return the number of elements in the underlying data.

Return the transpose, which is by definition self.

Return the memory usage of the Series.

Return True if there are any NaNs.

Indicator whether Series/DataFrame is empty.

Return the dtype object of the underlying data.

Return the name of the Series.

Get the properties associated with this pandas object.

Return a new object with updated flags.

Conversion#

Cast a pandas object to a specified dtype dtype .

Convert columns to the best possible dtypes using dtypes supporting pd.NA .

Attempt to infer better dtypes for object columns.

Make a copy of this object’s indices and data.

Return the bool of a single element Series or DataFrame.

A NumPy ndarray representing the values in this Series or Index.

Convert Series from DatetimeIndex to PeriodIndex.

Cast to DatetimeIndex of Timestamps, at beginning of period.

Return a list of the values.

Return the values as a NumPy array.

Indexing, iteration#

Get item from object for given key (ex: DataFrame column).

Access a single value for a row/column label pair.

Access a single value for a row/column pair by integer position.

Access a group of rows and columns by label(s) or a boolean array.

Purely integer-location based indexing for selection by position.

Return an iterator of the values.

Lazily iterate over (index, value) tuples.

Return item and drops from series.

Return the first element of the underlying data as a Python scalar.

Series.xs (key[, axis, level, drop_level])

Return cross-section from the Series/DataFrame.

For more information on .at , .iat , .loc , and .iloc , see the indexing documentation .

Binary operator functions#

Series.add (other[, level, fill_value, axis])

Return Addition of series and other, element-wise (binary operator add ).

Series.sub (other[, level, fill_value, axis])

Return Subtraction of series and other, element-wise (binary operator sub ).

Series.mul (other[, level, fill_value, axis])

Return Multiplication of series and other, element-wise (binary operator mul ).

Series.div (other[, level, fill_value, axis])

Return Floating division of series and other, element-wise (binary operator truediv ).

Series.truediv (other[, level, fill_value, axis])

Return Floating division of series and other, element-wise (binary operator truediv ).

Series.floordiv (other[, level, fill_value, axis])

Читайте также:  Qt creator for python

Return Integer division of series and other, element-wise (binary operator floordiv ).

Series.mod (other[, level, fill_value, axis])

Return Modulo of series and other, element-wise (binary operator mod ).

Series.pow (other[, level, fill_value, axis])

Return Exponential power of series and other, element-wise (binary operator pow ).

Series.radd (other[, level, fill_value, axis])

Return Addition of series and other, element-wise (binary operator radd ).

Series.rsub (other[, level, fill_value, axis])

Return Subtraction of series and other, element-wise (binary operator rsub ).

Series.rmul (other[, level, fill_value, axis])

Return Multiplication of series and other, element-wise (binary operator rmul ).

Series.rdiv (other[, level, fill_value, axis])

Return Floating division of series and other, element-wise (binary operator rtruediv ).

Series.rtruediv (other[, level, fill_value, axis])

Return Floating division of series and other, element-wise (binary operator rtruediv ).

Return Integer division of series and other, element-wise (binary operator rfloordiv ).

Series.rmod (other[, level, fill_value, axis])

Return Modulo of series and other, element-wise (binary operator rmod ).

Series.rpow (other[, level, fill_value, axis])

Return Exponential power of series and other, element-wise (binary operator rpow ).

Combine the Series with a Series or scalar according to func .

Update null elements with value in the same location in ‘other’.

Round each value in a Series to the given number of decimals.

Series.lt (other[, level, fill_value, axis])

Return Less than of series and other, element-wise (binary operator lt ).

Series.gt (other[, level, fill_value, axis])

Return Greater than of series and other, element-wise (binary operator gt ).

Series.le (other[, level, fill_value, axis])

Return Less than or equal to of series and other, element-wise (binary operator le ).

Series.ge (other[, level, fill_value, axis])

Return Greater than or equal to of series and other, element-wise (binary operator ge ).

Series.ne (other[, level, fill_value, axis])

Return Not equal to of series and other, element-wise (binary operator ne ).

Series.eq (other[, level, fill_value, axis])

Return Equal to of series and other, element-wise (binary operator eq ).

Return the product of the values over the requested axis.

Compute the dot product between the Series and the columns of other.

Function application, GroupBy & window#

Invoke function on values of Series.

Aggregate using one or more operations over the specified axis.

Aggregate using one or more operations over the specified axis.

Call func on self producing a Series with the same axis shape as self.

Map values of Series according to an input mapping or function.

Group Series using a mapper or by a Series of columns.

Provide rolling window calculations.

Provide expanding window calculations.

Provide exponentially weighted (EW) calculations.

Apply chainable functions that expect Series or DataFrames.

Computations / descriptive stats#

Return a Series/DataFrame with absolute numeric value of each element.

Return whether all elements are True, potentially over an axis.

Читайте также:  Special symbol for html

Return whether any element is True, potentially over an axis.

Compute the lag-N autocorrelation.

Return boolean Series equivalent to left

Trim values at input threshold(s).

Compute correlation with other Series, excluding missing values.

Return number of non-NA/null observations in the Series.

Compute covariance with Series, excluding missing values.

Return cumulative maximum over a DataFrame or Series axis.

Return cumulative minimum over a DataFrame or Series axis.

Return cumulative product over a DataFrame or Series axis.

Return cumulative sum over a DataFrame or Series axis.

Series.describe ([percentiles, include, exclude])

Generate descriptive statistics.

First discrete difference of element.

Encode the object as an enumerated type or categorical variable.

Return unbiased kurtosis over requested axis.

Return the maximum of the values over the requested axis.

Return the mean of the values over the requested axis.

Return the median of the values over the requested axis.

Return the minimum of the values over the requested axis.

Return the mode(s) of the Series.

Return the largest n elements.

Return the smallest n elements.

Percentage change between the current and a prior element.

Return the product of the values over the requested axis.

Return value at the given quantile.

Compute numerical data ranks (1 through n) along axis.

Series.sem ([axis, skipna, ddof, numeric_only])

Return unbiased standard error of the mean over requested axis.

Return unbiased skew over requested axis.

Series.std ([axis, skipna, ddof, numeric_only])

Return sample standard deviation over requested axis.

Return the sum of the values over the requested axis.

Series.var ([axis, skipna, ddof, numeric_only])

Return unbiased variance over requested axis.

Return unbiased kurtosis over requested axis.

Return unique values of Series object.

Return number of unique elements in the object.

Return boolean if values in the object are unique.

Return boolean if values in the object are monotonically increasing.

Return boolean if values in the object are monotonically decreasing.

Return a Series containing counts of unique values.

Reindexing / selection / label manipulation#

Align two objects on their axes with the specified join method.

Series.drop ([labels, axis, index, columns, . ])

Return Series with specified index labels removed.

Return Series/DataFrame with requested index / column level(s) removed.

Return Series with duplicate values removed.

Indicate duplicate Series values.

Test whether two objects contain the same elements.

Select initial periods of time series data based on a date offset.

Return the row label of the maximum value.

Return the row label of the minimum value.

Whether elements in Series are contained in values .

Select final periods of time series data based on a date offset.

Conform Series to new index with optional filling logic.

Return an object with matching indices as other object.

Alter Series index labels or name.

Читайте также:  Python is awesome!

Set the name of the axis for the index or columns.

Generate a new DataFrame or Series with the index reset.

Return a random sample of items from an axis of object.

Assign desired index to given axis.

Return the elements in the given positional indices along an axis.

Truncate a Series or DataFrame before and after some index value.

Series.where (cond[, other, inplace, axis, level])

Replace values where the condition is False.

Series.mask (cond[, other, inplace, axis, level])

Replace values where the condition is True.

Prefix labels with string prefix .

Suffix labels with string suffix .

Subset the dataframe rows or columns according to the specified index labels.

Missing data handling#

(DEPRECATED) Synonym for DataFrame.fillna() with method=’bfill’ .

Series.bfill (*[, axis, inplace, limit, downcast])

Synonym for DataFrame.fillna() with method=’bfill’ .

Return a new Series with missing values removed.

Series.ffill (*[, axis, inplace, limit, downcast])

Synonym for DataFrame.fillna() with method=’ffill’ .

Fill NA/NaN values using the specified method.

Fill NaN values using an interpolation method.

Series.isnull is an alias for Series.isna.

Detect existing (non-missing) values.

Series.notnull is an alias for Series.notna.

Series.pad (*[, axis, inplace, limit, downcast])

(DEPRECATED) Synonym for DataFrame.fillna() with method=’ffill’ .

Replace values given in to_replace with value .

Reshaping, sorting#

Return the integer indices that would sort the Series values.

Return int position of the smallest value in the Series.

Return int position of the largest value in the Series.

Rearrange index levels using input order.

Sort Series by index labels.

Unstack, also known as pivot, Series with MultiIndex to produce DataFrame.

Transform each element of a list-like to a row.

Find indices where elements should be inserted to maintain order.

Return the flattened underlying data as an ndarray or ExtensionArray.

Repeat elements of a Series.

Squeeze 1 dimensional axis objects into scalars.

Create a new view of the Series.

Combining / comparing / joining / merging#

Compare to another Series and show the differences.

Modify Series in place using values from passed Series.

Convert time series to specified frequency.

Return the last row(s) without any NaNs before where .

Series.shift ([periods, freq, axis, fill_value])

Shift index by desired number of periods with an optional time freq .

Return index for first non-NA value or None, if no non-NA value is found.

Return index for last non-NA value or None, if no non-NA value is found.

Convert tz-aware axis to target time zone.

Localize tz-naive index of a Series or DataFrame to target time zone.

Select values at particular time of day (e.g., 9:30AM).

Select values between particular times of the day (e.g., 9:00-9:30 AM).

Accessors#

pandas provides dtype-specific methods under various accessors. These are separate namespaces within Series that only apply to specific data types.

Datetime, Timedelta, Period

Источник

Оцените статью