DateOffset subclass representing possibly n custom business days.
The number of months represented.
Normalize start/end dates to midnight before generating date range.
Weekmask of valid business days, passed to numpy.busdaycalendar.
Start time of your custom business hour in 24h format.
End time of your custom business hour in 24h format.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
next_bday
Used for moving to next business day.
offset
Alias for self._offset.
calendar
end
freqstr
holidays
kwds
n
name
nanos
normalize
rule_code
start
weekmask
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback(other)
Roll provided date backward to next offset only if not on offset.
rollforward(other)
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


Returns a copy of the calling offset object with n=1 and all other attributes equal.


Roll provided date backward to next offset only if not on offset.


Roll provided date forward to next offset only if not on offset.


Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
cbday_roll
Define default roll function to be called in apply method.
month_roll
Define default roll function to be called in apply method.
offset
Alias for self._offset.
calendar
freqstr
holidays
kwds
m_offset
n
name
nanos
normalize
rule_code
weekmask
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


Define default roll function to be called in apply method.


Roll provided date backward to next offset only if not on offset.
Rolled timestamp if not on offset, otherwise unchanged timestamp.


Roll provided date forward to next offset only if not on offset.
Rolled timestamp if not on offset, otherwise unchanged timestamp.


Standard kind of date increment used for a date range.
Works exactly like the keyword argument form of relativedelta. Note that the positional argument form of relativedelata is not supported. Use of the keyword n is discouraged– you would be better off specifying n in the keywords you use, but regardless it is there for you. n is needed for DateOffset subclasses.
DateOffset works as follows. Each offset specify a set of dates that conform to the DateOffset. For example, Bday defines this set to be the set of dates that are weekdays (M-F). To test if a date is in the set of a DateOffset dateOffset we can use the is_on_offset method: dateOffset.is_on_offset(date).
If a date is not on a valid date, the rollback and rollforward methods can be used to roll the date to the nearest valid date before/after the date.
DateOffsets can be created to move dates forward a given number of valid dates. For example, Bday(2) can be added to a date to move it two business days forward. If the date does not start on a valid date, first it is moved to a valid date. Thus pseudo code is:
date = rollback(date) # does nothing if date is valid return date + <n number of periods>
When a date offset is created for a negative number of periods, the date is first rolled forward. The pseudo code is:
date = rollforward(date) # does nothing is date is valid return date + <n number of periods>
Zero presents a problem. Should it roll forward or back? We arbitrarily have it rollforward:
date + BDay(0) == BDay.rollforward(date)
Since 0 is a bit weird, we suggest avoiding its use.
The number of time periods the offset represents.
Whether to round the result of a DateOffset addition down to the previous midnight.
Temporal parameter that add to or replace the offset value.
Parameters that add to the offset (like Timedelta):
years
months
weeks
days
hours
minutes
seconds
microseconds
nanoseconds
Parameters that replace the offset value:
year
month
day
weekday
hour
minute
second
microsecond
nanosecond.
See also
The relativedelta type is designed to be applied to an existing datetime an can replace specific components of that datetime, or represents an interval of time.
Examples
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
delta
freqstr
kwds
n
name
nanos
normalize
rule_code
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


DateOffset for the Easter holiday using logic defined in dateutil.
Right now uses the revised method which is valid in years 1583-4099.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


Describes 52-53 week fiscal year. This is also known as a 4-4-5 calendar.
It is used by companies that desire that their fiscal year always end on the same day of the week.
It is a method of managing accounting periods. It is a common calendar structure for some industries, such as retail, manufacturing and parking industry.
For more information see: https://en.wikipedia.org/wiki/4-4-5_calendar
The year may either:
end on the last X day of the Y month.
end on the last X day closest to the last day of the Y month.
X is a specific day of the week. Y is a certain month of the year
A specific integer for the day of the week.
0 is Monday
1 is Tuesday
2 is Wednesday
3 is Thursday
4 is Friday
5 is Saturday
6 is Sunday.
The month in which the fiscal year ends.
Method of employing 4-4-5 calendar.
There are two options:
“nearest” means year end is weekday closest to last day of month in year.
“last” means year end is final weekday of the final month in fiscal year.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
startingMonth
variation
weekday
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
get_rule_code_suffix
get_year_end
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


DateOffset increments between business quarter dates for 52-53 week fiscal year (also known as a 4-4-5 calendar).
It is used by companies that desire that their fiscal year always end on the same day of the week.
It is a method of managing accounting periods. It is a common calendar structure for some industries, such as retail, manufacturing and parking industry.
For more information see: https://en.wikipedia.org/wiki/4-4-5_calendar
The year may either:
end on the last X day of the Y month.
end on the last X day closest to the last day of the Y month.
X is a specific day of the week. Y is a certain month of the year
startingMonth = 1 corresponds to dates like 1/31/2007, 4/30/2007, … startingMonth = 2 corresponds to dates like 2/28/2007, 5/31/2007, … startingMonth = 3 corresponds to dates like 3/30/2007, 6/29/2007, …
A specific integer for the day of the week.
0 is Monday
1 is Tuesday
2 is Wednesday
3 is Thursday
4 is Friday
5 is Saturday
6 is Sunday.
The month in which fiscal years end.
The quarter number that has the leap or 14 week when needed.
Method of employing 4-4-5 calendar.
There are two options:
“nearest” means year end is weekday closest to last day of month in year.
“last” means year end is final weekday of the final month in fiscal year.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
qtr_with_extra_week
rule_code
startingMonth
variation
weekday
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
get_rule_code_suffix
get_weeks
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset
year_has_extra_week


Describes monthly dates in last week of month like “the last Tuesday of each month”.
A specific integer for the day of the week.
0 is Monday
1 is Tuesday
2 is Wednesday
3 is Thursday
4 is Friday
5 is Saturday
6 is Sunday.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
week
weekday
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


DateOffset of one month at beginning.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


DateOffset of one month end.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


DateOffset increments between Quarter start dates.
startingMonth = 1 corresponds to dates like 1/01/2007, 4/01/2007, … startingMonth = 2 corresponds to dates like 2/01/2007, 5/01/2007, … startingMonth = 3 corresponds to dates like 3/01/2007, 6/01/2007, …
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
startingMonth
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


DateOffset increments between Quarter end dates.
startingMonth = 1 corresponds to dates like 1/31/2007, 4/30/2007, … startingMonth = 2 corresponds to dates like 2/28/2007, 5/31/2007, … startingMonth = 3 corresponds to dates like 3/31/2007, 6/30/2007, …
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
startingMonth
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


Returns a copy of the calling offset object with n=1 and all other attributes equal.


Two DateOffset’s per month repeating on the first day of the month and day_of_month.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
day_of_month
freqstr
kwds
n
name
nanos
normalize
rule_code
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


Two DateOffset’s per month repeating on the last day of the month and day_of_month.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
day_of_month
freqstr
kwds
n
name
nanos
normalize
rule_code
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


Weekly offset.
Always generate specific day of week. 0 for Monday.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
weekday
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


Describes monthly dates like “the Tuesday of the 2nd week of each month”.
A specific integer for the week of the month. e.g. 0 is 1st week of month, 1 is the 2nd week, etc.
A specific integer for the day of the week.
0 is Monday
1 is Tuesday
2 is Wednesday
3 is Thursday
4 is Friday
5 is Saturday
6 is Sunday.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
n
name
nanos
normalize
rule_code
week
weekday
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


Roll provided date backward to next offset only if not on offset.
Rolled timestamp if not on offset, otherwise unchanged timestamp.


Roll provided date forward to next offset only if not on offset.
Rolled timestamp if not on offset, otherwise unchanged timestamp.


DateOffset increments between calendar year begin dates.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
month
n
name
nanos
normalize
rule_code
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


DateOffset increments between calendar year ends.
Attributes
base
Returns a copy of the calling offset object with n=1 and all other attributes equal.
freqstr
kwds
month
n
name
nanos
normalize
rule_code
Methods
__call__(*args, **kwargs)
Call self as a function.
rollback
Roll provided date backward to next offset only if not on offset.
rollforward
Roll provided date forward to next offset only if not on offset.
apply
apply_index
copy
isAnchored
is_anchored
is_month_end
is_month_start
is_on_offset
is_quarter_end
is_quarter_start
is_year_end
is_year_start
onOffset


An ExtensionDtype for uint16 integer data.
Changed in version 1.0.0: Now uses pandas.NA as its missing value, rather than numpy.nan.
Attributes
None
Methods
None


An ExtensionDtype for uint32 integer data.
Changed in version 1.0.0: Now uses pandas.NA as its missing value, rather than numpy.nan.
Attributes
None
Methods
None


An ExtensionDtype for uint64 integer data.
Changed in version 1.0.0: Now uses pandas.NA as its missing value, rather than numpy.nan.
Attributes
None
Methods
None


Immutable sequence used for indexing and alignment. The basic object storing axis labels for all pandas objects. UInt64Index is a special case of Index with purely unsigned integer labels. .
Deprecated since version 1.4.0: In pandas v2.0 UInt64Index will be removed and NumericIndex used instead. UInt64Index will remain fully functional for the duration of pandas 1.x.
Make a copy of input ndarray.
Name to be stored in the index.
See also
The base pandas Index type.
Index of numpy int/uint/float data.
Notes
An Index instance can only contain hashable objects.
Attributes
None
Methods
None


An ExtensionDtype for uint8 integer data.
Changed in version 1.0.0: Now uses pandas.NA as its missing value, rather than numpy.nan.
Attributes
None
Methods
None


Return unique values based on a hash table.
Uniques are returned in order of appearance. This does NOT sort.
Significantly faster than numpy.unique for long enough sequences. Includes NA values.
The return can be:
Index : when the input is an Index
Categorical : when the input is a Categorical dtype
ndarray : when the input is a Series/ndarray
Return numpy.ndarray or ExtensionArray.
See also
Return unique values from an Index.
Return unique values of Series object.
Examples
An unordered Categorical will return categories in the order of appearance.
An ordered Categorical preserves the category ordering.
An array of tuples


Given a 1d array, return an array of deterministic integers.
Encoding for data & key when strings.
Hash_key for string key to encode.
Whether to first categorize object arrays before hashing. This is more efficient when the array contains duplicate values.
Hashed values, same length as the vals.


Return a data hash of the Index/Series/DataFrame.
Include the index in the hash (if Series/DataFrame).
Encoding for data & key when strings.
Hash_key for string key to encode.
Whether to first categorize object arrays before hashing. This is more efficient when the array contains duplicate values.


Unpivot a DataFrame from wide to long format.
Less flexible but more user-friendly than melt.
With stubnames [‘A’, ‘B’], this function expects to find one or more group of columns with format A-suffix1, A-suffix2,…, B-suffix1, B-suffix2,… You specify what you want to call this suffix in the resulting long format with j (for example j=’year’)
Each row of these wide variables are assumed to be uniquely identified by i (can be a single column name or a list of column names)
All remaining variables in the data frame are left intact.
The wide-format DataFrame.
The stub name(s). The wide format variables are assumed to start with the stub names.
Column(s) to use as id variable(s).
The name of the sub-observation variable. What you wish to name your suffix in the long format.
A character indicating the separation of the variable names in the wide format, to be stripped from the names in the long format. For example, if your column names are A-suffix1, A-suffix2, you can strip the hyphen by specifying sep=’-’.
A regular expression capturing the wanted suffixes. ‘\d+’ captures numeric suffixes. Suffixes with no numbers could be specified with the negated character class ‘\D+’. You can also further disambiguate suffixes, for example, if your wide variables are of the form A-one, B-two,.., and you have an unrelated column A-rating, you can ignore the last one by specifying suffix=’(!?one|two)’. When all suffixes are numeric, they are cast to int64/float64.
A DataFrame that contains each stub name as a variable, with new index (i, j).
See also
Unpivot a DataFrame from wide to long format, optionally leaving identifiers set.
Create a spreadsheet-style pivot table as a DataFrame.
Pivot without aggregation that can handle non-numeric data.
Generalization of pivot that can handle duplicate values for one index/column pair.
Pivot based on the index values instead of a column.
Notes
All extra variables are left untouched. This simply uses pandas.melt under the hood, but is hard-coded to “do the right thing” in a typical case.
Examples
With multiple id columns
Going from long back to wide just takes some creative use of unstack
Less wieldy column names are also handled
If we have many columns, we could also use a regex to find our stubnames and pass that list on to wide_to_long
All of the above examples have integers as suffixes. It is possible to have non-integers as suffixes.


The following functions are contained in the pandas.plotting module.
andrews_curves(frame, class_column[, ax, ...])
Generate a matplotlib plot of Andrews curves, for visualising clusters of multivariate data.
autocorrelation_plot(series[, ax])
Autocorrelation plot for time series.
bootstrap_plot(series[, fig, size, samples])
Bootstrap plot on mean, median and mid-range statistics.
boxplot(data[, column, by, ax, fontsize, ...])
Make a box plot from DataFrame columns.
deregister_matplotlib_converters()
Remove pandas formatters and converters.
lag_plot(series[, lag, ax])
Lag plot for time series.
parallel_coordinates(frame, class_column[, ...])
Parallel coordinates plotting.
plot_params
Stores pandas plotting options.
radviz(frame, class_column[, ax, color, ...])
Plot a multidimensional dataset in 2D.
register_matplotlib_converters()
Register pandas formatters and converters with matplotlib.
scatter_matrix(frame[, alpha, figsize, ax, ...])
Draw a matrix of scatter plots.
table(ax, data[, rowLabels, colLabels])
Helper function to convert DataFrame and Series to matplotlib.table.


Resampler objects are returned by resample calls: pandas.DataFrame.resample(), pandas.Series.resample().
Resampler.__iter__()
Groupby iterator.
Resampler.groups
Dict {group name -> group labels}.
Resampler.indices
Dict {group name -> group indices}.
Resampler.get_group(name[, obj])
Construct DataFrame from group with provided name.
Resampler.apply([func])
Aggregate using one or more operations over the specified axis.
Resampler.aggregate([func])
Aggregate using one or more operations over the specified axis.
Resampler.transform(arg, *args, **kwargs)
Call function producing a like-indexed Series on each group and return a Series with the transformed values.
Resampler.pipe(func, *args, **kwargs)
Apply a function func with arguments to this Resampler object and return the function's result.
Resampler.ffill([limit])
Forward fill the values.
Resampler.backfill([limit])
Backward fill the new missing values in the resampled data.
Resampler.bfill([limit])
Backward fill the new missing values in the resampled data.
Resampler.pad([limit])
Forward fill the values.
Resampler.nearest([limit])
Resample by using the nearest value.
Resampler.fillna(method[, limit])
Fill missing values introduced by upsampling.
Resampler.asfreq([fill_value])
Return the values at the new freq, essentially a reindex.
Resampler.interpolate([method, axis, limit, ...])
Interpolate values according to different methods.
Resampler.count()
Compute count of group, excluding missing values.
Resampler.nunique([_method])
Return number of unique elements in the group.
Resampler.first([_method, min_count])
Compute first of group values.
Resampler.last([_method, min_count])
Compute last of group values.
Resampler.max([_method, min_count])
Compute max of group values.
Resampler.mean([_method])
Compute mean of groups, excluding missing values.
Resampler.median([_method])
Compute median of groups, excluding missing values.
Resampler.min([_method, min_count])
Compute min of group values.
Resampler.ohlc([_method])
Compute open, high, low and close values of a group, excluding missing values.
Resampler.prod([_method, min_count])
Compute prod of group values.
Resampler.size()
Compute group sizes.
Resampler.sem([_method])
Compute standard error of the mean of groups, excluding missing values.
Resampler.std([ddof])
Compute standard deviation of groups, excluding missing values.
Resampler.sum([_method, min_count])
Compute sum of group values.
Resampler.var([ddof])
Compute variance of groups, excluding missing values.
Resampler.quantile([q])
Return value at the given quantile.


Series([data, index, dtype, name, copy, ...])
One-dimensional ndarray with axis labels (including time series).
Axes
Series.index
The index (axis labels) of the Series.
Series.array
The ExtensionArray of the data backing this Series or Index.
Series.values
Return Series as ndarray or ndarray-like depending on the dtype.
Series.dtype
Return the dtype object of the underlying data.
Series.shape
Return a tuple of the shape of the underlying data.
Series.nbytes
Return the number of bytes in the underlying data.
Series.ndim
Number of dimensions of the underlying data, by definition 1.
Series.size
Return the number of elements in the underlying data.
Series.T
Return the transpose, which is by definition self.
Series.memory_usage([index, deep])
Return the memory usage of the Series.
Series.hasnans
Return True if there are any NaNs.
Series.empty
Indicator whether Series/DataFrame is empty.
Series.dtypes
Return the dtype object of the underlying data.
Series.name
Return the name of the Series.
Series.flags
Get the properties associated with this pandas object.
Series.set_flags(*[, copy, ...])
Return a new object with updated flags.
Series.astype(dtype[, copy, errors])
Cast a pandas object to a specified dtype dtype.
Series.convert_dtypes([infer_objects, ...])
Convert columns to best possible dtypes using dtypes supporting pd.NA.
Series.infer_objects()
Attempt to infer better dtypes for object columns.
Series.copy([deep])
Make a copy of this object's indices and data.
Series.bool()
Return the bool of a single element Series or DataFrame.
Series.to_numpy([dtype, copy, na_value])
A NumPy ndarray representing the values in this Series or Index.
Series.to_period([freq, copy])
Convert Series from DatetimeIndex to PeriodIndex.
Series.to_timestamp([freq, how, copy])
Cast to DatetimeIndex of Timestamps, at beginning of period.
Series.to_list()
Return a list of the values.
Series.__array__([dtype])
Return the values as a NumPy array.
Series.get(key[, default])
Get item from object for given key (ex: DataFrame column).
Series.at
Access a single value for a row/column label pair.
Series.iat
Access a single value for a row/column pair by integer position.
Series.loc
Access a group of rows and columns by label(s) or a boolean array.
Series.iloc
Purely integer-location based indexing for selection by position.
Series.__iter__()
Return an iterator of the values.
Series.items()
Lazily iterate over (index, value) tuples.
Series.iteritems()
Lazily iterate over (index, value) tuples.
Series.keys()
Return alias for index.
Series.pop(item)
Return item and drops from series.
Series.item()
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.
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])
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).
Series.rfloordiv(other[, level, fill_value, ...])
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).
Series.combine(other, func[, fill_value])
Combine the Series with a Series or scalar according to func.
Series.combine_first(other)
Update null elements with value in the same location in 'other'.
Series.round([decimals])
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).
Series.product([axis, skipna, level, ...])
Return the product of the values over the requested axis.
Series.dot(other)
Compute the dot product between the Series and the columns of other.
Series.apply(func[, convert_dtype, args])
Invoke function on values of Series.
Series.agg([func, axis])
Aggregate using one or more operations over the specified axis.
Series.aggregate([func, axis])
Aggregate using one or more operations over the specified axis.
Series.transform(func[, axis])
Call func on self producing a Series with the same axis shape as self.
Series.map(arg[, na_action])
Map values of Series according to an input mapping or function.
Series.groupby([by, axis, level, as_index, ...])
Group Series using a mapper or by a Series of columns.
Series.rolling(window[, min_periods, ...])
Provide rolling window calculations.
Series.expanding([min_periods, center, ...])
Provide expanding window calculations.
Series.ewm([com, span, halflife, alpha, ...])
Provide exponentially weighted (EW) calculations.
Series.pipe(func, *args, **kwargs)
Apply chainable functions that expect Series or DataFrames.
Series.abs()
Return a Series/DataFrame with absolute numeric value of each element.
Series.all([axis, bool_only, skipna, level])
Return whether all elements are True, potentially over an axis.
Series.any([axis, bool_only, skipna, level])
Return whether any element is True, potentially over an axis.
Series.autocorr([lag])
Compute the lag-N autocorrelation.
Series.between(left, right[, inclusive])
Return boolean Series equivalent to left <= series <= right.
Series.clip([lower, upper, axis, inplace])
Trim values at input threshold(s).
Series.corr(other[, method, min_periods])
Compute correlation with other Series, excluding missing values.
Series.count([level])
Return number of non-NA/null observations in the Series.
Series.cov(other[, min_periods, ddof])
Compute covariance with Series, excluding missing values.
Series.cummax([axis, skipna])
Return cumulative maximum over a DataFrame or Series axis.
Series.cummin([axis, skipna])
Return cumulative minimum over a DataFrame or Series axis.
Series.cumprod([axis, skipna])
Return cumulative product over a DataFrame or Series axis.
Series.cumsum([axis, skipna])
Return cumulative sum over a DataFrame or Series axis.
Series.describe([percentiles, include, ...])
Generate descriptive statistics.
Series.diff([periods])
First discrete difference of element.
Series.factorize([sort, na_sentinel])
Encode the object as an enumerated type or categorical variable.
Series.kurt([axis, skipna, level, numeric_only])
Return unbiased kurtosis over requested axis.
Series.mad([axis, skipna, level])
Return the mean absolute deviation of the values over the requested axis.
Series.max([axis, skipna, level, numeric_only])
Return the maximum of the values over the requested axis.
Series.mean([axis, skipna, level, numeric_only])
Return the mean of the values over the requested axis.
Series.median([axis, skipna, level, ...])
Return the median of the values over the requested axis.
Series.min([axis, skipna, level, numeric_only])
Return the minimum of the values over the requested axis.
Series.mode([dropna])
Return the mode(s) of the Series.
Series.nlargest([n, keep])
Return the largest n elements.
Series.nsmallest([n, keep])
Return the smallest n elements.
Series.pct_change([periods, fill_method, ...])
Percentage change between the current and a prior element.
Series.prod([axis, skipna, level, ...])
Return the product of the values over the requested axis.
Series.quantile([q, interpolation])
Return value at the given quantile.
Series.rank([axis, method, numeric_only, ...])
Compute numerical data ranks (1 through n) along axis.
Series.sem([axis, skipna, level, ddof, ...])
Return unbiased standard error of the mean over requested axis.
Series.skew([axis, skipna, level, numeric_only])
Return unbiased skew over requested axis.
Series.std([axis, skipna, level, ddof, ...])
Return sample standard deviation over requested axis.
Series.sum([axis, skipna, level, ...])
Return the sum of the values over the requested axis.
Series.var([axis, skipna, level, ddof, ...])
Return unbiased variance over requested axis.
Series.kurtosis([axis, skipna, level, ...])
Return unbiased kurtosis over requested axis.
Series.unique()
Return unique values of Series object.
Series.nunique([dropna])
Return number of unique elements in the object.
Series.is_unique
Return boolean if values in the object are unique.
Series.is_monotonic
Return boolean if values in the object are monotonic_increasing.
Series.is_monotonic_increasing
Alias for is_monotonic.
Series.is_monotonic_decreasing
Return boolean if values in the object are monotonic_decreasing.
Series.value_counts([normalize, sort, ...])
Return a Series containing counts of unique values.
Series.align(other[, join, axis, level, ...])
Align two objects on their axes with the specified join method.
Series.drop([labels, axis, index, columns, ...])
Return Series with specified index labels removed.
Series.droplevel(level[, axis])
Return Series/DataFrame with requested index / column level(s) removed.
Series.drop_duplicates([keep, inplace])
Return Series with duplicate values removed.
Series.duplicated([keep])
Indicate duplicate Series values.
Series.equals(other)
Test whether two objects contain the same elements.
Series.first(offset)
Select initial periods of time series data based on a date offset.
Series.head([n])
Return the first n rows.
Series.idxmax([axis, skipna])
Return the row label of the maximum value.
Series.idxmin([axis, skipna])
Return the row label of the minimum value.
Series.isin(values)
Whether elements in Series are contained in values.
Series.last(offset)
Select final periods of time series data based on a date offset.
Series.reindex(*args, **kwargs)
Conform Series to new index with optional filling logic.
Series.reindex_like(other[, method, copy, ...])
Return an object with matching indices as other object.
Series.rename([index, axis, copy, inplace, ...])
Alter Series index labels or name.
Series.rename_axis([mapper, index, columns, ...])
Set the name of the axis for the index or columns.
Series.reset_index([level, drop, name, inplace])
Generate a new DataFrame or Series with the index reset.
Series.sample([n, frac, replace, weights, ...])
Return a random sample of items from an axis of object.
Series.set_axis(labels[, axis, inplace])
Assign desired index to given axis.
Series.take(indices[, axis, is_copy])
Return the elements in the given positional indices along an axis.
Series.tail([n])
Return the last n rows.
Series.truncate([before, after, axis, copy])
Truncate a Series or DataFrame before and after some index value.
Series.where(cond[, other, inplace, axis, ...])
Replace values where the condition is False.
Series.mask(cond[, other, inplace, axis, ...])
Replace values where the condition is True.
Series.add_prefix(prefix)
Prefix labels with string prefix.
Series.add_suffix(suffix)
Suffix labels with string suffix.
Series.filter([items, like, regex, axis])
Subset the dataframe rows or columns according to the specified index labels.
Series.backfill([axis, inplace, limit, downcast])
Synonym for DataFrame.fillna() with method='bfill'.
Series.bfill([axis, inplace, limit, downcast])
Synonym for DataFrame.fillna() with method='bfill'.
Series.dropna([axis, inplace, how])
Return a new Series with missing values removed.
Series.ffill([axis, inplace, limit, downcast])
Synonym for DataFrame.fillna() with method='ffill'.
Series.fillna([value, method, axis, ...])
Fill NA/NaN values using the specified method.
Series.interpolate([method, axis, limit, ...])
Fill NaN values using an interpolation method.
Series.isna()
Detect missing values.
Series.isnull()
Series.isnull is an alias for Series.isna.
Series.notna()
Detect existing (non-missing) values.
Series.notnull()
Series.notnull is an alias for Series.notna.
Series.pad([axis, inplace, limit, downcast])
Synonym for DataFrame.fillna() with method='ffill'.
Series.replace([to_replace, value, inplace, ...])
Replace values given in to_replace with value.
Series.argsort([axis, kind, order])
Return the integer indices that would sort the Series values.
Series.argmin([axis, skipna])
Return int position of the smallest value in the Series.
Series.argmax([axis, skipna])
Return int position of the largest value in the Series.
Series.reorder_levels(order)
Rearrange index levels using input order.
Series.sort_values([axis, ascending, ...])
Sort by the values.
Series.sort_index([axis, level, ascending, ...])
Sort Series by index labels.
Series.swaplevel([i, j, copy])
Swap levels i and j in a MultiIndex.
Series.unstack([level, fill_value])
Unstack, also known as pivot, Series with MultiIndex to produce DataFrame.
Series.explode([ignore_index])
Transform each element of a list-like to a row.
Series.searchsorted(value[, side, sorter])
Find indices where elements should be inserted to maintain order.
Series.ravel([order])
Return the flattened underlying data as an ndarray.
Series.repeat(repeats[, axis])
Repeat elements of a Series.
Series.squeeze([axis])
Squeeze 1 dimensional axis objects into scalars.
Series.view([dtype])
Create a new view of the Series.
Series.append(to_append[, ignore_index, ...])
Concatenate two or more Series.
Series.compare(other[, align_axis, ...])
Compare to another Series and show the differences.
Series.update(other)
Modify Series in place using values from passed Series.
Series.asfreq(freq[, method, how, ...])
Convert time series to specified frequency.
Series.asof(where[, subset])
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.
Series.first_valid_index()
Return index for first non-NA value or None, if no NA value is found.
Series.last_valid_index()
Return index for last non-NA value or None, if no NA value is found.
Series.resample(rule[, axis, closed, label, ...])
Resample time-series data.
Series.tz_convert(tz[, axis, level, copy])
Convert tz-aware axis to target time zone.
Series.tz_localize(tz[, axis, level, copy, ...])
Localize tz-naive index of a Series or DataFrame to target time zone.
Series.at_time(time[, asof, axis])
Select values at particular time of day (e.g., 9:30AM).
Series.between_time(start_time, end_time[, ...])
Select values between particular times of the day (e.g., 9:00-9:30 AM).
Series.tshift([periods, freq, axis])
(DEPRECATED) Shift the time index, using the index's frequency if available.
Series.slice_shift([periods, axis])
(DEPRECATED) Equivalent to shift without copying data.
pandas provides dtype-specific methods under various accessors. These are separate namespaces within Series that only apply to specific data types.
Data Type
Accessor
Datetime, Timedelta, Period
dt
String
str
Categorical
cat
Sparse
sparse
Series.dt can be used to access the values of the series as datetimelike and return several properties. These can be accessed like Series.dt.<property>.
Series.dt.date
Returns numpy array of python datetime.date objects.
Series.dt.time
Returns numpy array of datetime.time objects.
Series.dt.timetz
Returns numpy array of datetime.time objects with timezone information.
Series.dt.year
The year of the datetime.
Series.dt.month
The month as January=1, December=12.
Series.dt.day
The day of the datetime.
Series.dt.hour
The hours of the datetime.
Series.dt.minute
The minutes of the datetime.
Series.dt.second
The seconds of the datetime.
Series.dt.microsecond
The microseconds of the datetime.
Series.dt.nanosecond
The nanoseconds of the datetime.
Series.dt.week
(DEPRECATED) The week ordinal of the year.
Series.dt.weekofyear
(DEPRECATED) The week ordinal of the year.
Series.dt.dayofweek
The day of the week with Monday=0, Sunday=6.
Series.dt.day_of_week
The day of the week with Monday=0, Sunday=6.
Series.dt.weekday
The day of the week with Monday=0, Sunday=6.
Series.dt.dayofyear
The ordinal day of the year.
Series.dt.day_of_year
The ordinal day of the year.
Series.dt.quarter
The quarter of the date.
Series.dt.is_month_start
Indicates whether the date is the first day of the month.
Series.dt.is_month_end
Indicates whether the date is the last day of the month.
Series.dt.is_quarter_start
Indicator for whether the date is the first day of a quarter.
Series.dt.is_quarter_end
Indicator for whether the date is the last day of a quarter.
Series.dt.is_year_start
Indicate whether the date is the first day of a year.
Series.dt.is_year_end
Indicate whether the date is the last day of the year.
Series.dt.is_leap_year
Boolean indicator if the date belongs to a leap year.
Series.dt.daysinmonth
The number of days in the month.
Series.dt.days_in_month
The number of days in the month.
Series.dt.tz
Return the timezone.
Series.dt.freq
Return the frequency object for this PeriodArray.
Series.dt.to_period(*args, **kwargs)
Cast to PeriodArray/Index at a particular frequency.
Series.dt.to_pydatetime()
Return the data as an array of datetime.datetime objects.
Series.dt.tz_localize(*args, **kwargs)
Localize tz-naive Datetime Array/Index to tz-aware Datetime Array/Index.
Series.dt.tz_convert(*args, **kwargs)
Convert tz-aware Datetime Array/Index from one time zone to another.
Series.dt.normalize(*args, **kwargs)
Convert times to midnight.
Series.dt.strftime(*args, **kwargs)
Convert to Index using specified date_format.
Series.dt.round(*args, **kwargs)
Perform round operation on the data to the specified freq.
Series.dt.floor(*args, **kwargs)
Perform floor operation on the data to the specified freq.
Series.dt.ceil(*args, **kwargs)
Perform ceil operation on the data to the specified freq.
Series.dt.month_name(*args, **kwargs)
Return the month names of the DateTimeIndex with specified locale.
Series.dt.day_name(*args, **kwargs)
Return the day names of the DateTimeIndex with specified locale.
Series.dt.qyear
Series.dt.start_time
Series.dt.end_time
Series.dt.days
Number of days for each element.
Series.dt.seconds
Number of seconds (>= 0 and less than 1 day) for each element.
Series.dt.microseconds
Number of microseconds (>= 0 and less than 1 second) for each element.
Series.dt.nanoseconds
Number of nanoseconds (>= 0 and less than 1 microsecond) for each element.
Series.dt.components
Return a Dataframe of the components of the Timedeltas.
Series.dt.to_pytimedelta()
Return an array of native datetime.timedelta objects.
Series.dt.total_seconds(*args, **kwargs)
Return total duration of each element expressed in seconds.
Series.str can be used to access the values of the series as strings and apply several methods to it. These can be accessed like Series.str.<function/property>.
Series.str.capitalize()
Convert strings in the Series/Index to be capitalized.
Series.str.casefold()
Convert strings in the Series/Index to be casefolded.
Series.str.cat([others, sep, na_rep, join])
Concatenate strings in the Series/Index with given separator.
Series.str.center(width[, fillchar])
Pad left and right side of strings in the Series/Index.
Series.str.contains(pat[, case, flags, na, ...])
Test if pattern or regex is contained within a string of a Series or Index.
Series.str.count(pat[, flags])
Count occurrences of pattern in each string of the Series/Index.
Series.str.decode(encoding[, errors])
Decode character string in the Series/Index using indicated encoding.
Series.str.encode(encoding[, errors])
Encode character string in the Series/Index using indicated encoding.
Series.str.endswith(pat[, na])
Test if the end of each string element matches a pattern.
Series.str.extract(pat[, flags, expand])
Extract capture groups in the regex pat as columns in a DataFrame.
Series.str.extractall(pat[, flags])
Extract capture groups in the regex pat as columns in DataFrame.
Series.str.find(sub[, start, end])
Return lowest indexes in each strings in the Series/Index.
Series.str.findall(pat[, flags])
Find all occurrences of pattern or regular expression in the Series/Index.
Series.str.fullmatch(pat[, case, flags, na])
Determine if each string entirely matches a regular expression.
Series.str.get(i)
Extract element from each component at specified position.
Series.str.index(sub[, start, end])
Return lowest indexes in each string in Series/Index.
Series.str.join(sep)
Join lists contained as elements in the Series/Index with passed delimiter.
Series.str.len()
Compute the length of each element in the Series/Index.
Series.str.ljust(width[, fillchar])
Pad right side of strings in the Series/Index.
Series.str.lower()
Convert strings in the Series/Index to lowercase.
Series.str.lstrip([to_strip])
Remove leading characters.
Series.str.match(pat[, case, flags, na])
Determine if each string starts with a match of a regular expression.
Series.str.normalize(form)
Return the Unicode normal form for the strings in the Series/Index.
Series.str.pad(width[, side, fillchar])
Pad strings in the Series/Index up to width.
Series.str.partition([sep, expand])
Split the string at the first occurrence of sep.
Series.str.removeprefix(prefix)
Remove a prefix from an object series.
Series.str.removesuffix(suffix)
Remove a suffix from an object series.
Series.str.repeat(repeats)
Duplicate each string in the Series or Index.
Series.str.replace(pat, repl[, n, case, ...])
Replace each occurrence of pattern/regex in the Series/Index.
Series.str.rfind(sub[, start, end])
Return highest indexes in each strings in the Series/Index.
Series.str.rindex(sub[, start, end])
Return highest indexes in each string in Series/Index.
Series.str.rjust(width[, fillchar])
Pad left side of strings in the Series/Index.
Series.str.rpartition([sep, expand])
Split the string at the last occurrence of sep.
Series.str.rstrip([to_strip])
Remove trailing characters.
Series.str.slice([start, stop, step])
Slice substrings from each element in the Series or Index.
Series.str.slice_replace([start, stop, repl])
Replace a positional slice of a string with another value.
Series.str.split([pat, n, expand, regex])
Split strings around given separator/delimiter.
Series.str.rsplit([pat, n, expand])
Split strings around given separator/delimiter.
Series.str.startswith(pat[, na])
Test if the start of each string element matches a pattern.
Series.str.strip([to_strip])
Remove leading and trailing characters.
Series.str.swapcase()
Convert strings in the Series/Index to be swapcased.
Series.str.title()
Convert strings in the Series/Index to titlecase.
Series.str.translate(table)
Map all characters in the string through the given mapping table.
Series.str.upper()
Convert strings in the Series/Index to uppercase.
Series.str.wrap(width, **kwargs)
Wrap strings in Series/Index at specified line width.
Series.str.zfill(width)
Pad strings in the Series/Index by prepending '0' characters.
Series.str.isalnum()
Check whether all characters in each string are alphanumeric.
Series.str.isalpha()
Check whether all characters in each string are alphabetic.
Series.str.isdigit()
Check whether all characters in each string are digits.
Series.str.isspace()
Check whether all characters in each string are whitespace.
Series.str.islower()
Check whether all characters in each string are lowercase.
Series.str.isupper()
Check whether all characters in each string are uppercase.
Series.str.istitle()
Check whether all characters in each string are titlecase.
Series.str.isnumeric()
Check whether all characters in each string are numeric.
Series.str.isdecimal()
Check whether all characters in each string are decimal.
Series.str.get_dummies([sep])
Return DataFrame of dummy/indicator variables for Series.
Categorical-dtype specific methods and attributes are available under the Series.cat accessor.
Series.cat.categories
The categories of this categorical.
Series.cat.ordered
Whether the categories have an ordered relationship.
Series.cat.codes
Return Series of codes as well as the index.
Series.cat.rename_categories(*args, **kwargs)
Rename categories.
Series.cat.reorder_categories(*args, **kwargs)
Reorder categories as specified in new_categories.
Series.cat.add_categories(*args, **kwargs)
Add new categories.
Series.cat.remove_categories(*args, **kwargs)
Remove the specified categories.
Series.cat.remove_unused_categories(*args, ...)
Remove categories which are not used.
Series.cat.set_categories(*args, **kwargs)
Set the categories to the specified new_categories.
Series.cat.as_ordered(*args, **kwargs)
Set the Categorical to be ordered.
Series.cat.as_unordered(*args, **kwargs)
Set the Categorical to be unordered.
Sparse-dtype specific methods and attributes are provided under the Series.sparse accessor.
Series.sparse.npoints
The number of non- fill_value points.
Series.sparse.density
The percent of non- fill_value points, as decimal.
Series.sparse.fill_value
Elements in data that are fill_value are not stored.
Series.sparse.sp_values
An ndarray containing the non- fill_value values.
Series.sparse.from_coo(A[, dense_index])
Create a Series with sparse values from a scipy.sparse.coo_matrix.
Series.sparse.to_coo([row_levels, ...])
Create a scipy.sparse.coo_matrix from a Series with MultiIndex.
Flags refer to attributes of the pandas object. Properties of the dataset (like the date is was recorded, the URL it was accessed from, etc.) should be stored in Series.attrs.
Flags(obj, *, allows_duplicate_labels)
Flags that apply to pandas objects.
Series.attrs is a dictionary for storing global metadata for this Series.
Warning
Series.attrs is considered experimental and may change without warning.
Series.attrs
Dictionary of global attributes of this dataset.
Series.plot is both a callable method and a namespace attribute for specific plotting methods of the form Series.plot.<kind>.
Series.plot([kind, ax, figsize, ....])
Series plotting accessor and method
Series.plot.area([x, y])
Draw a stacked area plot.
Series.plot.bar([x, y])
Vertical bar plot.
Series.plot.barh([x, y])
Make a horizontal bar plot.
Series.plot.box([by])
Make a box plot of the DataFrame columns.
Series.plot.density([bw_method, ind])
Generate Kernel Density Estimate plot using Gaussian kernels.
Series.plot.hist([by, bins])
Draw one histogram of the DataFrame's columns.
Series.plot.kde([bw_method, ind])
Generate Kernel Density Estimate plot using Gaussian kernels.
Series.plot.line([x, y])
Plot Series or DataFrame as lines.
Series.plot.pie(**kwargs)
Generate a pie plot.
Series.hist([by, ax, grid, xlabelsize, ...])
Draw histogram of the input series using matplotlib.
Series.to_pickle(path[, compression, ...])
Pickle (serialize) object to file.
Series.to_csv([path_or_buf, sep, na_rep, ...])
Write object to a comma-separated values (csv) file.
Series.to_dict([into])
Convert Series to {label -> value} dict or dict-like object.
Series.to_excel(excel_writer[, sheet_name, ...])
Write object to an Excel sheet.
Series.to_frame([name])
Convert Series to DataFrame.
Series.to_xarray()
Return an xarray object from the pandas object.
Series.to_hdf(path_or_buf, key[, mode, ...])
Write the contained data to an HDF5 file using HDFStore.
Series.to_sql(name, con[, schema, ...])
Write records stored in a DataFrame to a SQL database.
Series.to_json([path_or_buf, orient, ...])
Convert the object to a JSON string.
Series.to_string([buf, na_rep, ...])
Render a string representation of the Series.
Series.to_clipboard([excel, sep])
Copy object to the system clipboard.
Series.to_latex([buf, columns, col_space, ...])
Render object to a LaTeX tabular, longtable, or nested table.
Series.to_markdown([buf, mode, index, ...])
Print Series in Markdown-friendly format.


Styler objects are returned by pandas.DataFrame.style.
Styler(data[, precision, table_styles, ...])
Helps style a DataFrame or Series according to the data with HTML and CSS.
Styler.from_custom_template(searchpath[, ...])
Factory function for creating a subclass of Styler.
Styler.env
Styler.template_html
Styler.template_html_style
Styler.template_html_table
Styler.template_latex
Styler.loader
Styler.apply(func[, axis, subset])
Apply a CSS-styling function column-wise, row-wise, or table-wise.
Styler.applymap(func[, subset])
Apply a CSS-styling function elementwise.
Styler.apply_index(func[, axis, level])
Apply a CSS-styling function to the index or column headers, level-wise.
Styler.applymap_index(func[, axis, level])
Apply a CSS-styling function to the index or column headers, elementwise.
Styler.format([formatter, subset, na_rep, ...])
Format the text display value of cells.
Styler.format_index([formatter, axis, ...])
Format the text display value of index labels or column headers.
Styler.hide([subset, axis, level, names])
Hide the entire index / column headers, or specific rows / columns from display.
Styler.set_td_classes(classes)
Set the DataFrame of strings added to the class attribute of <td> HTML elements.
Styler.set_table_styles([table_styles, ...])
Set the table styles included within the <style> HTML element.
Styler.set_table_attributes(attributes)
Set the table attributes added to the <table> HTML element.
Styler.set_tooltips(ttips[, props, css_class])
Set the DataFrame of strings on Styler generating :hover tooltips.
Styler.set_caption(caption)
Set the text added to a <caption> HTML element.
Styler.set_sticky([axis, pixel_size, levels])
Add CSS to permanently display the index or column headers in a scrolling frame.
Styler.set_properties([subset])
Set defined CSS-properties to each <td> HTML element within the given subset.
Styler.set_uuid(uuid)
Set the uuid applied to id attributes of HTML elements.
Styler.clear()
Reset the Styler, removing any previously applied styles.
Styler.pipe(func, *args, **kwargs)
Apply func(self, *args, **kwargs), and return the result.
Styler.highlight_null([null_color, subset, ...])
Highlight missing values with a style.
Styler.highlight_max([subset, color, axis, ...])
Highlight the maximum with a style.
Styler.highlight_min([subset, color, axis, ...])
Highlight the minimum with a style.
Styler.highlight_between([subset, color, ...])
Highlight a defined range with a style.
Styler.highlight_quantile([subset, color, ...])
Highlight values defined by a quantile with a style.
Styler.background_gradient([cmap, low, ...])
Color the background in a gradient style.
Styler.text_gradient([cmap, low, high, ...])
Color the text in a gradient style.
Styler.bar([subset, axis, color, cmap, ...])
Draw bar chart in the cell backgrounds.
Styler.to_html([buf, table_uuid, ...])
Write Styler to a file, buffer or string in HTML-CSS format.
Styler.to_latex([buf, column_format, ...])
Write Styler to a file, buffer or string in LaTeX format.
Styler.to_excel(excel_writer[, sheet_name, ...])
Write Styler to an Excel sheet.
Styler.export()
Export the styles applied to the current Styler.
Styler.use(styles)
Set the styles on the current Styler.


Rolling objects are returned by .rolling calls: pandas.DataFrame.rolling(), pandas.Series.rolling(), etc. Expanding objects are returned by .expanding calls: pandas.DataFrame.expanding(), pandas.Series.expanding(), etc. ExponentialMovingWindow objects are returned by .ewm calls: pandas.DataFrame.ewm(), pandas.Series.ewm(), etc.
Rolling.count()
Calculate the rolling count of non NaN observations.
Rolling.sum(*args[, engine, engine_kwargs])
Calculate the rolling sum.
Rolling.mean(*args[, engine, engine_kwargs])
Calculate the rolling mean.
Rolling.median([engine, engine_kwargs])
Calculate the rolling median.
Rolling.var([ddof, engine, engine_kwargs])
Calculate the rolling variance.
Rolling.std([ddof, engine, engine_kwargs])
Calculate the rolling standard deviation.
Rolling.min(*args[, engine, engine_kwargs])
Calculate the rolling minimum.
Rolling.max(*args[, engine, engine_kwargs])
Calculate the rolling maximum.
Rolling.corr([other, pairwise, ddof])
Calculate the rolling correlation.
Rolling.cov([other, pairwise, ddof])
Calculate the rolling sample covariance.
Rolling.skew(**kwargs)
Calculate the rolling unbiased skewness.
Rolling.kurt(**kwargs)
Calculate the rolling Fisher's definition of kurtosis without bias.
Rolling.apply(func[, raw, engine, ...])
Calculate the rolling custom aggregation function.
Rolling.aggregate(func, *args, **kwargs)
Aggregate using one or more operations over the specified axis.
Rolling.quantile(quantile[, interpolation])
Calculate the rolling quantile.
Rolling.sem([ddof])
Calculate the rolling standard error of mean.
Rolling.rank([method, ascending, pct])
Calculate the rolling rank.
Window.mean(*args, **kwargs)
Calculate the rolling weighted window mean.
Window.sum(*args, **kwargs)
Calculate the rolling weighted window sum.
Window.var([ddof])
Calculate the rolling weighted window variance.
Window.std([ddof])
Calculate the rolling weighted window standard deviation.
Expanding.count()
Calculate the expanding count of non NaN observations.
Expanding.sum(*args[, engine, engine_kwargs])
Calculate the expanding sum.
Expanding.mean(*args[, engine, engine_kwargs])
Calculate the expanding mean.
Expanding.median([engine, engine_kwargs])
Calculate the expanding median.
Expanding.var([ddof, engine, engine_kwargs])
Calculate the expanding variance.
Expanding.std([ddof, engine, engine_kwargs])
Calculate the expanding standard deviation.
Expanding.min(*args[, engine, engine_kwargs])
Calculate the expanding minimum.
Expanding.max(*args[, engine, engine_kwargs])
Calculate the expanding maximum.
Expanding.corr([other, pairwise, ddof])
Calculate the expanding correlation.
Expanding.cov([other, pairwise, ddof])
Calculate the expanding sample covariance.
Expanding.skew(**kwargs)
Calculate the expanding unbiased skewness.
Expanding.kurt(**kwargs)
Calculate the expanding Fisher's definition of kurtosis without bias.
Expanding.apply(func[, raw, engine, ...])
Calculate the expanding custom aggregation function.
Expanding.aggregate(func, *args, **kwargs)
Aggregate using one or more operations over the specified axis.
Expanding.quantile(quantile[, interpolation])
Calculate the expanding quantile.
Expanding.sem([ddof])
Calculate the expanding standard error of mean.
Expanding.rank([method, ascending, pct])
Calculate the expanding rank.
ExponentialMovingWindow.mean(*args[, ...])
Calculate the ewm (exponential weighted moment) mean.
ExponentialMovingWindow.sum(*args[, engine, ...])
Calculate the ewm (exponential weighted moment) sum.
ExponentialMovingWindow.std([bias])
Calculate the ewm (exponential weighted moment) standard deviation.
ExponentialMovingWindow.var([bias])
Calculate the ewm (exponential weighted moment) variance.
ExponentialMovingWindow.corr([other, pairwise])
Calculate the ewm (exponential weighted moment) sample correlation.
ExponentialMovingWindow.cov([other, ...])
Calculate the ewm (exponential weighted moment) sample covariance.
Base class for defining custom window boundaries.
api.indexers.BaseIndexer([index_array, ...])
Base class for window bounds calculations.
api.indexers.FixedForwardWindowIndexer([...])
Creates window boundaries for fixed-length windows that include the current row.
api.indexers.VariableOffsetWindowIndexer([...])
Calculate window boundaries based on a non-fixed offset such as a BusinessDay.


skimage.color.combine_stains(stains, conv_matrix)
Stain to RGB color space conversion.
skimage.color.convert_colorspace(arr, …)
Convert an image array to a new color space.
skimage.color.deltaE_cie76(lab1, lab2)
Euclidean distance between two points in Lab color space
skimage.color.deltaE_ciede2000(lab1, lab2[, …])
Color difference as given by the CIEDE 2000 standard.
skimage.color.deltaE_ciede94(lab1, lab2[, …])
Color difference according to CIEDE 94 standard
skimage.color.deltaE_cmc(lab1, lab2[, kL, kC])
Color difference from the CMC l:c standard.
skimage.color.gray2rgb(image[, alpha])
Create an RGB representation of a gray-level image.
skimage.color.gray2rgba(image[, alpha])
Create a RGBA representation of a gray-level image.
skimage.color.grey2rgb(image[, alpha])
Create an RGB representation of a gray-level image.
skimage.color.hed2rgb(hed)
Haematoxylin-Eosin-DAB (HED) to RGB color space conversion.
skimage.color.hsv2rgb(hsv)
HSV to RGB color space conversion.
skimage.color.lab2lch(lab)
CIE-LAB to CIE-LCH color space conversion.
skimage.color.lab2rgb(lab[, illuminant, …])
Lab to RGB color space conversion.
skimage.color.lab2xyz(lab[, illuminant, …])
CIE-LAB to XYZcolor space conversion.
skimage.color.label2rgb(label[, image, …])
Return an RGB image where color-coded labels are painted over the image.
skimage.color.lch2lab(lch)
CIE-LCH to CIE-LAB color space conversion.
skimage.color.rgb2gray(rgb)
Compute luminance of an RGB image.
skimage.color.rgb2grey(rgb)
Compute luminance of an RGB image.
skimage.color.rgb2hed(rgb)
RGB to Haematoxylin-Eosin-DAB (HED) color space conversion.
skimage.color.rgb2hsv(rgb)
RGB to HSV color space conversion.
skimage.color.rgb2lab(rgb[, illuminant, …])
Conversion from the sRGB color space (IEC 61966-2-1:1999) to the CIE Lab colorspace under the given illuminant and observer.
skimage.color.rgb2rgbcie(rgb)
RGB to RGB CIE color space conversion.
skimage.color.rgb2xyz(rgb)
RGB to XYZ color space conversion.
skimage.color.rgb2ycbcr(rgb)
RGB to YCbCr color space conversion.
skimage.color.rgb2ydbdr(rgb)
RGB to YDbDr color space conversion.
skimage.color.rgb2yiq(rgb)
RGB to YIQ color space conversion.
skimage.color.rgb2ypbpr(rgb)
RGB to YPbPr color space conversion.
skimage.color.rgb2yuv(rgb)
RGB to YUV color space conversion.
skimage.color.rgba2rgb(rgba[, background])
RGBA to RGB conversion using alpha blending [1].
skimage.color.rgbcie2rgb(rgbcie)
RGB CIE to RGB color space conversion.
skimage.color.separate_stains(rgb, conv_matrix)
RGB to stain color space conversion.
skimage.color.xyz2lab(xyz[, illuminant, …])
XYZ to CIE-LAB color space conversion.
skimage.color.xyz2rgb(xyz)
XYZ to RGB color space conversion.
skimage.color.ycbcr2rgb(ycbcr)
YCbCr to RGB color space conversion.
skimage.color.ydbdr2rgb(ydbdr)
YDbDr to RGB color space conversion.
skimage.color.yiq2rgb(yiq)
YIQ to RGB color space conversion.
skimage.color.ypbpr2rgb(ypbpr)
YPbPr to RGB color space conversion.
skimage.color.yuv2rgb(yuv)
YUV to RGB color space conversion.
Stain to RGB color space conversion.
The image in stain color space. Final dimension denotes channels.
The stain separation matrix as described by G. Landini [1].
The image in RGB format. Same dimensions as input.
If stains is not at least 2-D with shape (…, 3).
Stain combination matrices available in the color module and their respective colorspace:
https://web.archive.org/web/20160624145052/http://www.mecourse.com/landinig/software/cdeconv/cdeconv.html
A. C. Ruifrok and D. A. Johnston, “Quantification of histochemical staining by color deconvolution,” Anal. Quant. Cytol. Histol., vol. 23, no. 4, pp. 291–299, Aug. 2001.
Convert an image array to a new color space.
‘RGB’, ‘HSV’, ‘RGB CIE’, ‘XYZ’, ‘YUV’, ‘YIQ’, ‘YPbPr’, ‘YCbCr’, ‘YDbDr’
The image to convert. Final dimension denotes channels.
The color space to convert from. Can be specified in lower case.
The color space to convert to. Can be specified in lower case.
The converted image. Same dimensions as input.
If fromspace is not a valid color space
If tospace is not a valid color space
Conversion is performed through the “central” RGB color space, i.e. conversion from XYZ to HSV is implemented as XYZ -> RGB -> HSV instead of directly.
Euclidean distance between two points in Lab color space
reference color (Lab colorspace)
comparison color (Lab colorspace)
distance between colors lab1 and lab2
https://en.wikipedia.org/wiki/Color_difference
A. R. Robertson, “The CIE 1976 color-difference formulae,” Color Res. Appl. 2, 7-11 (1977).
Color difference as given by the CIEDE 2000 standard.
CIEDE 2000 is a major revision of CIDE94. The perceptual calibration is largely based on experience with automotive paint on smooth surfaces.
reference color (Lab colorspace)
comparison color (Lab colorspace)
lightness scale factor, 1 for “acceptably close”; 2 for “imperceptible” see deltaE_cmc
chroma scale factor, usually 1
hue scale factor, usually 1
The distance between lab1 and lab2
CIEDE 2000 assumes parametric weighting factors for the lightness, chroma, and hue (kL, kC, kH respectively). These default to 1.
https://en.wikipedia.org/wiki/Color_difference
http://www.ece.rochester.edu/~gsharma/ciede2000/ciede2000noteCRNA.pdf DOI:10.1364/AO.33.008069
M. Melgosa, J. Quesada, and E. Hita, “Uniformity of some recent color metrics tested with an accurate color-difference tolerance dataset,” Appl. Opt. 33, 8069-8077 (1994).
Color difference according to CIEDE 94 standard
Accommodates perceptual non-uniformities through the use of application specific scale factors (kH, kC, kL, k1, and k2).
reference color (Lab colorspace)
comparison color (Lab colorspace)
Hue scale
Chroma scale
Lightness scale
first scale parameter
second scale parameter
color difference between lab1 and lab2
deltaE_ciede94 is not symmetric with respect to lab1 and lab2. CIEDE94 defines the scales for the lightness, hue, and chroma in terms of the first color. Consequently, the first color should be regarded as the “reference” color.
kL, k1, k2 depend on the application and default to the values suggested for graphic arts
Parameter
Graphic Arts
Textiles
kL
1.000
2.000
k1
0.045
0.048
k2
0.015
0.014
https://en.wikipedia.org/wiki/Color_difference
http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE94.html
Color difference from the CMC l:c standard.
This color difference was developed by the Colour Measurement Committee (CMC) of the Society of Dyers and Colourists (United Kingdom). It is intended for use in the textile industry.
The scale factors kL, kC set the weight given to differences in lightness and chroma relative to differences in hue. The usual values are kL=2, kC=1 for “acceptability” and kL=1, kC=1 for “imperceptibility”. Colors with dE > 1 are “different” for the given scale factors.
reference color (Lab colorspace)
comparison color (Lab colorspace)
distance between colors lab1 and lab2
deltaE_cmc the defines the scales for the lightness, hue, and chroma in terms of the first color. Consequently deltaE_cmc(lab1, lab2) != deltaE_cmc(lab2, lab1)
https://en.wikipedia.org/wiki/Color_difference
http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE94.html
F. J. J. Clarke, R. McDonald, and B. Rigg, “Modification to the JPC79 colour-difference formula,” J. Soc. Dyers Colour. 100, 128-132 (1984).
Create an RGB representation of a gray-level image.
Input image.
Ensure that the output image has an alpha layer. If None, alpha layers are passed through but not created.
RGB image. A new dimension of length 3 is added to input image.
If the input is a 1-dimensional image of shape (M, ), the output will be shape (M, 3).
Tinting gray-scale images
Create a RGBA representation of a gray-level image.
Input image.
Alpha channel of the output image. It may be a scalar or an array that can be broadcast to image. If not specified it is set to the maximum limit corresponding to the image dtype.
RGBA image. A new dimension of length 4 is added to input image shape.
Create an RGB representation of a gray-level image.
Input image.
Ensure that the output image has an alpha layer. If None, alpha layers are passed through but not created.
RGB image. A new dimension of length 3 is added to input image.
If the input is a 1-dimensional image of shape (M, ), the output will be shape (M, 3).
Haematoxylin-Eosin-DAB (HED) to RGB color space conversion.
The image in the HED color space. Final dimension denotes channels.
The image in RGB. Same dimensions as input.
If hed is not at least 2-D with shape (…, 3).
A. C. Ruifrok and D. A. Johnston, “Quantification of histochemical staining by color deconvolution.,” Analytical and quantitative cytology and histology / the International Academy of Cytology [and] American Society of Cytology, vol. 23, no. 4, pp. 291-9, Aug. 2001.
HSV to RGB color space conversion.
The image in HSV format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If hsv is not at least 2-D with shape (…, 3).
Conversion between RGB and HSV color spaces results in some loss of precision, due to integer arithmetic and rounding [1].
https://en.wikipedia.org/wiki/HSL_and_HSV
Tinting gray-scale images
Flood Fill
CIE-LAB to CIE-LCH color space conversion.
LCH is the cylindrical representation of the LAB (Cartesian) colorspace
The N-D image in CIE-LAB format. The last (N+1-th) dimension must have at least 3 elements, corresponding to the L, a, and b color channels. Subsequent elements are copied.
The image in LCH format, in a N-D array with same shape as input lab.
If lch does not have at least 3 color channels (i.e. l, a, b).
The Hue is expressed as an angle between (0, 2*pi)
Lab to RGB color space conversion.
The image in Lab format. Final dimension denotes channels.
The name of the illuminant (the function is NOT case sensitive).
The aperture angle of the observer.
The image in RGB format. Same dimensions as input.
If lab is not at least 2-D with shape (…, 3).
This function uses lab2xyz and xyz2rgb. By default Observer= 2A, Illuminant= D65. CIE XYZ tristimulus values x_ref=95.047, y_ref=100., z_ref=108.883. See function get_xyz_coords for a list of supported illuminants.
https://en.wikipedia.org/wiki/Standard_illuminant
CIE-LAB to XYZcolor space conversion.
The image in Lab format. Final dimension denotes channels.
The name of the illuminant (the function is NOT case sensitive).
The aperture angle of the observer.
The image in XYZ format. Same dimensions as input.
If lab is not at least 2-D with shape (…, 3).
If either the illuminant or the observer angle are not supported or unknown.
If any of the pixels are invalid (Z < 0).
By default Observer= 2A, Illuminant= D65. CIE XYZ tristimulus values x_ref = 95.047, y_ref = 100., z_ref = 108.883. See function ‘get_xyz_coords’ for a list of supported illuminants.
http://www.easyrgb.com/index.php?X=MATH&H=07
https://en.wikipedia.org/wiki/Lab_color_space
Return an RGB image where color-coded labels are painted over the image.
Integer array of labels with the same shape as image.
Image used as underlay for labels. If the input is an RGB image, it’s converted to grayscale before coloring.
List of colors. If the number of labels exceeds the number of colors, then the colors are cycled.
Opacity of colorized labels. Ignored if image is None.
Label that’s treated as the background. If bg_label is specified, bg_color is None, and kind is overlay, background is not painted by any colors.
Background color. Must be a name in color_dict or RGB float values between [0, 1].
Opacity of the image.
The kind of color image desired. ‘overlay’ cycles over defined colors and overlays the colored labels over the original image. ‘avg’ replaces each labeled segment with its average color, for a stained-class or pastel painting appearance.
The result of blending a cycling colormap (colors) for each distinct value in label with the image, at a certain alpha value.
Segment human cells (in mitosis)
CIE-LCH to CIE-LAB color space conversion.
LCH is the cylindrical representation of the LAB (Cartesian) colorspace
The N-D image in CIE-LCH format. The last (N+1-th) dimension must have at least 3 elements, corresponding to the L, a, and b color channels. Subsequent elements are copied.
The image in LAB format, with same shape as input lch.
If lch does not have at least 3 color channels (i.e. l, c, h).
Compute luminance of an RGB image.
The image in RGB format. Final dimension denotes channels.
The luminance image - an array which is the same size as the input array, but with the channel dimension removed.
If rgb is not at least 2-D with shape (…, 3).
The weights used in this conversion are calibrated for contemporary CRT phosphors:
If there is an alpha channel present, it is ignored.
http://poynton.ca/PDFs/ColorFAQ.pdf
Registration using optical flow
Phase Unwrapping
Compute luminance of an RGB image.
The image in RGB format. Final dimension denotes channels.
The luminance image - an array which is the same size as the input array, but with the channel dimension removed.
If rgb is not at least 2-D with shape (…, 3).
The weights used in this conversion are calibrated for contemporary CRT phosphors:
If there is an alpha channel present, it is ignored.
http://poynton.ca/PDFs/ColorFAQ.pdf
RGB to Haematoxylin-Eosin-DAB (HED) color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in HED format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
A. C. Ruifrok and D. A. Johnston, “Quantification of histochemical staining by color deconvolution.,” Analytical and quantitative cytology and histology / the International Academy of Cytology [and] American Society of Cytology, vol. 23, no. 4, pp. 291-9, Aug. 2001.
RGB to HSV color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in HSV format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
Conversion between RGB and HSV color spaces results in some loss of precision, due to integer arithmetic and rounding [1].
https://en.wikipedia.org/wiki/HSL_and_HSV
Tinting gray-scale images
Flood Fill
Conversion from the sRGB color space (IEC 61966-2-1:1999) to the CIE Lab colorspace under the given illuminant and observer.
The image in RGB format. Final dimension denotes channels.
The name of the illuminant (the function is NOT case sensitive).
The aperture angle of the observer.
The image in Lab format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
RGB is a device-dependent color space so, if you use this function, be sure that the image you are analyzing has been mapped to the sRGB color space.
This function uses rgb2xyz and xyz2lab. By default Observer= 2A, Illuminant= D65. CIE XYZ tristimulus values x_ref=95.047, y_ref=100., z_ref=108.883. See function get_xyz_coords for a list of supported illuminants.
https://en.wikipedia.org/wiki/Standard_illuminant
RGB to RGB CIE color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in RGB CIE format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
https://en.wikipedia.org/wiki/CIE_1931_color_space
RGB to XYZ color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in XYZ format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
The CIE XYZ color space is derived from the CIE RGB color space. Note however that this function converts from sRGB.
https://en.wikipedia.org/wiki/CIE_1931_color_space
RGB to YCbCr color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in YCbCr format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
Y is between 16 and 235. This is the color space commonly used by video codecs; it is sometimes incorrectly called “YUV”.
https://en.wikipedia.org/wiki/YCbCr
RGB to YDbDr color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in YDbDr format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
This is the color space commonly used by video codecs. It is also the reversible color transform in JPEG2000.
https://en.wikipedia.org/wiki/YDbDr
RGB to YIQ color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in YIQ format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
RGB to YPbPr color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in YPbPr format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
https://en.wikipedia.org/wiki/YPbPr
RGB to YUV color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in YUV format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
Y is between 0 and 1. Use YCbCr instead of YUV for the color space commonly used by video codecs, where Y ranges from 16 to 235.
https://en.wikipedia.org/wiki/YUV
RGBA to RGB conversion using alpha blending [1].
The image in RGBA format. Final dimension denotes channels.
The color of the background to blend the image with (3 floats between 0 to 1 - the RGB value of the background).
The image in RGB format. Same dimensions as input.
If rgba is not at least 2-D with shape (…, 4).
https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
RGB CIE to RGB color space conversion.
The image in RGB CIE format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If rgbcie is not at least 2-D with shape (…, 3).
https://en.wikipedia.org/wiki/CIE_1931_color_space
RGB to stain color space conversion.
The image in RGB format. Final dimension denotes channels.
The stain separation matrix as described by G. Landini [1].
The image in stain color space. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
Stain separation matrices available in the color module and their respective colorspace:
This implementation borrows some ideas from DIPlib [2], e.g. the compensation using a small value to avoid log artifacts when calculating the Beer-Lambert law.
https://web.archive.org/web/20160624145052/http://www.mecourse.com/landinig/software/cdeconv/cdeconv.html
https://github.com/DIPlib/diplib/
A. C. Ruifrok and D. A. Johnston, “Quantification of histochemical staining by color deconvolution,” Anal. Quant. Cytol. Histol., vol. 23, no. 4, pp. 291–299, Aug. 2001.
XYZ to CIE-LAB color space conversion.
The image in XYZ format. Final dimension denotes channels.
The name of the illuminant (the function is NOT case sensitive).
The aperture angle of the observer.
The image in CIE-LAB format. Same dimensions as input.
If xyz is not at least 2-D with shape (…, 3).
If either the illuminant or the observer angle is unsupported or unknown.
By default Observer= 2A, Illuminant= D65. CIE XYZ tristimulus values x_ref=95.047, y_ref=100., z_ref=108.883. See function get_xyz_coords for a list of supported illuminants.
http://www.easyrgb.com/index.php?X=MATH&H=07
https://en.wikipedia.org/wiki/Lab_color_space
XYZ to RGB color space conversion.
The image in XYZ format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If xyz is not at least 2-D with shape (…, 3).
The CIE XYZ color space is derived from the CIE RGB color space. Note however that this function converts to sRGB.
https://en.wikipedia.org/wiki/CIE_1931_color_space
YCbCr to RGB color space conversion.
The image in YCbCr format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If ycbcr is not at least 2-D with shape (…, 3).
Y is between 16 and 235. This is the color space commonly used by video codecs; it is sometimes incorrectly called “YUV”.
https://en.wikipedia.org/wiki/YCbCr
YDbDr to RGB color space conversion.
The image in YDbDr format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If ydbdr is not at least 2-D with shape (…, 3).
This is the color space commonly used by video codecs, also called the reversible color transform in JPEG2000.
https://en.wikipedia.org/wiki/YDbDr
YIQ to RGB color space conversion.
The image in YIQ format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If yiq is not at least 2-D with shape (…, 3).
YPbPr to RGB color space conversion.
The image in YPbPr format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If ypbpr is not at least 2-D with shape (…, 3).
https://en.wikipedia.org/wiki/YPbPr
YUV to RGB color space conversion.
The image in YUV format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If yuv is not at least 2-D with shape (…, 3).
https://en.wikipedia.org/wiki/YUV


Stain to RGB color space conversion.
The image in stain color space. Final dimension denotes channels.
The stain separation matrix as described by G. Landini [1].
The image in RGB format. Same dimensions as input.
If stains is not at least 2-D with shape (…, 3).
Stain combination matrices available in the color module and their respective colorspace:
https://web.archive.org/web/20160624145052/http://www.mecourse.com/landinig/software/cdeconv/cdeconv.html
A. C. Ruifrok and D. A. Johnston, “Quantification of histochemical staining by color deconvolution,” Anal. Quant. Cytol. Histol., vol. 23, no. 4, pp. 291–299, Aug. 2001.


Convert an image array to a new color space.
‘RGB’, ‘HSV’, ‘RGB CIE’, ‘XYZ’, ‘YUV’, ‘YIQ’, ‘YPbPr’, ‘YCbCr’, ‘YDbDr’
The image to convert. Final dimension denotes channels.
The color space to convert from. Can be specified in lower case.
The color space to convert to. Can be specified in lower case.
The converted image. Same dimensions as input.
If fromspace is not a valid color space
If tospace is not a valid color space
Conversion is performed through the “central” RGB color space, i.e. conversion from XYZ to HSV is implemented as XYZ -> RGB -> HSV instead of directly.


Euclidean distance between two points in Lab color space
reference color (Lab colorspace)
comparison color (Lab colorspace)
distance between colors lab1 and lab2
https://en.wikipedia.org/wiki/Color_difference
A. R. Robertson, “The CIE 1976 color-difference formulae,” Color Res. Appl. 2, 7-11 (1977).


Color difference as given by the CIEDE 2000 standard.
CIEDE 2000 is a major revision of CIDE94. The perceptual calibration is largely based on experience with automotive paint on smooth surfaces.
reference color (Lab colorspace)
comparison color (Lab colorspace)
lightness scale factor, 1 for “acceptably close”; 2 for “imperceptible” see deltaE_cmc
chroma scale factor, usually 1
hue scale factor, usually 1
The distance between lab1 and lab2
CIEDE 2000 assumes parametric weighting factors for the lightness, chroma, and hue (kL, kC, kH respectively). These default to 1.
https://en.wikipedia.org/wiki/Color_difference
http://www.ece.rochester.edu/~gsharma/ciede2000/ciede2000noteCRNA.pdf DOI:10.1364/AO.33.008069
M. Melgosa, J. Quesada, and E. Hita, “Uniformity of some recent color metrics tested with an accurate color-difference tolerance dataset,” Appl. Opt. 33, 8069-8077 (1994).


Color difference according to CIEDE 94 standard
Accommodates perceptual non-uniformities through the use of application specific scale factors (kH, kC, kL, k1, and k2).
reference color (Lab colorspace)
comparison color (Lab colorspace)
Hue scale
Chroma scale
Lightness scale
first scale parameter
second scale parameter
color difference between lab1 and lab2
deltaE_ciede94 is not symmetric with respect to lab1 and lab2. CIEDE94 defines the scales for the lightness, hue, and chroma in terms of the first color. Consequently, the first color should be regarded as the “reference” color.
kL, k1, k2 depend on the application and default to the values suggested for graphic arts
Parameter
Graphic Arts
Textiles
kL
1.000
2.000
k1
0.045
0.048
k2
0.015
0.014
https://en.wikipedia.org/wiki/Color_difference
http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE94.html


Color difference from the CMC l:c standard.
This color difference was developed by the Colour Measurement Committee (CMC) of the Society of Dyers and Colourists (United Kingdom). It is intended for use in the textile industry.
The scale factors kL, kC set the weight given to differences in lightness and chroma relative to differences in hue. The usual values are kL=2, kC=1 for “acceptability” and kL=1, kC=1 for “imperceptibility”. Colors with dE > 1 are “different” for the given scale factors.
reference color (Lab colorspace)
comparison color (Lab colorspace)
distance between colors lab1 and lab2
deltaE_cmc the defines the scales for the lightness, hue, and chroma in terms of the first color. Consequently deltaE_cmc(lab1, lab2) != deltaE_cmc(lab2, lab1)
https://en.wikipedia.org/wiki/Color_difference
http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE94.html
F. J. J. Clarke, R. McDonald, and B. Rigg, “Modification to the JPC79 colour-difference formula,” J. Soc. Dyers Colour. 100, 128-132 (1984).


Create an RGB representation of a gray-level image.
Input image.
Ensure that the output image has an alpha layer. If None, alpha layers are passed through but not created.
RGB image. A new dimension of length 3 is added to input image.
If the input is a 1-dimensional image of shape (M, ), the output will be shape (M, 3).


Create a RGBA representation of a gray-level image.
Input image.
Alpha channel of the output image. It may be a scalar or an array that can be broadcast to image. If not specified it is set to the maximum limit corresponding to the image dtype.
RGBA image. A new dimension of length 4 is added to input image shape.


Haematoxylin-Eosin-DAB (HED) to RGB color space conversion.
The image in the HED color space. Final dimension denotes channels.
The image in RGB. Same dimensions as input.
If hed is not at least 2-D with shape (…, 3).
A. C. Ruifrok and D. A. Johnston, “Quantification of histochemical staining by color deconvolution.,” Analytical and quantitative cytology and histology / the International Academy of Cytology [and] American Society of Cytology, vol. 23, no. 4, pp. 291-9, Aug. 2001.


HSV to RGB color space conversion.
The image in HSV format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If hsv is not at least 2-D with shape (…, 3).
Conversion between RGB and HSV color spaces results in some loss of precision, due to integer arithmetic and rounding [1].
https://en.wikipedia.org/wiki/HSL_and_HSV


CIE-LAB to CIE-LCH color space conversion.
LCH is the cylindrical representation of the LAB (Cartesian) colorspace
The N-D image in CIE-LAB format. The last (N+1-th) dimension must have at least 3 elements, corresponding to the L, a, and b color channels. Subsequent elements are copied.
The image in LCH format, in a N-D array with same shape as input lab.
If lch does not have at least 3 color channels (i.e. l, a, b).
The Hue is expressed as an angle between (0, 2*pi)


Lab to RGB color space conversion.
The image in Lab format. Final dimension denotes channels.
The name of the illuminant (the function is NOT case sensitive).
The aperture angle of the observer.
The image in RGB format. Same dimensions as input.
If lab is not at least 2-D with shape (…, 3).
This function uses lab2xyz and xyz2rgb. By default Observer= 2A, Illuminant= D65. CIE XYZ tristimulus values x_ref=95.047, y_ref=100., z_ref=108.883. See function get_xyz_coords for a list of supported illuminants.
https://en.wikipedia.org/wiki/Standard_illuminant


CIE-LAB to XYZcolor space conversion.
The image in Lab format. Final dimension denotes channels.
The name of the illuminant (the function is NOT case sensitive).
The aperture angle of the observer.
The image in XYZ format. Same dimensions as input.
If lab is not at least 2-D with shape (…, 3).
If either the illuminant or the observer angle are not supported or unknown.
If any of the pixels are invalid (Z < 0).
By default Observer= 2A, Illuminant= D65. CIE XYZ tristimulus values x_ref = 95.047, y_ref = 100., z_ref = 108.883. See function ‘get_xyz_coords’ for a list of supported illuminants.
http://www.easyrgb.com/index.php?X=MATH&H=07
https://en.wikipedia.org/wiki/Lab_color_space


Return an RGB image where color-coded labels are painted over the image.
Integer array of labels with the same shape as image.
Image used as underlay for labels. If the input is an RGB image, it’s converted to grayscale before coloring.
List of colors. If the number of labels exceeds the number of colors, then the colors are cycled.
Opacity of colorized labels. Ignored if image is None.
Label that’s treated as the background. If bg_label is specified, bg_color is None, and kind is overlay, background is not painted by any colors.
Background color. Must be a name in color_dict or RGB float values between [0, 1].
Opacity of the image.
The kind of color image desired. ‘overlay’ cycles over defined colors and overlays the colored labels over the original image. ‘avg’ replaces each labeled segment with its average color, for a stained-class or pastel painting appearance.
The result of blending a cycling colormap (colors) for each distinct value in label with the image, at a certain alpha value.


CIE-LCH to CIE-LAB color space conversion.
LCH is the cylindrical representation of the LAB (Cartesian) colorspace
The N-D image in CIE-LCH format. The last (N+1-th) dimension must have at least 3 elements, corresponding to the L, a, and b color channels. Subsequent elements are copied.
The image in LAB format, with same shape as input lch.
If lch does not have at least 3 color channels (i.e. l, c, h).


Compute luminance of an RGB image.
The image in RGB format. Final dimension denotes channels.
The luminance image - an array which is the same size as the input array, but with the channel dimension removed.
If rgb is not at least 2-D with shape (…, 3).
The weights used in this conversion are calibrated for contemporary CRT phosphors:
If there is an alpha channel present, it is ignored.
http://poynton.ca/PDFs/ColorFAQ.pdf


RGB to Haematoxylin-Eosin-DAB (HED) color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in HED format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
A. C. Ruifrok and D. A. Johnston, “Quantification of histochemical staining by color deconvolution.,” Analytical and quantitative cytology and histology / the International Academy of Cytology [and] American Society of Cytology, vol. 23, no. 4, pp. 291-9, Aug. 2001.


RGB to HSV color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in HSV format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
Conversion between RGB and HSV color spaces results in some loss of precision, due to integer arithmetic and rounding [1].
https://en.wikipedia.org/wiki/HSL_and_HSV


Conversion from the sRGB color space (IEC 61966-2-1:1999) to the CIE Lab colorspace under the given illuminant and observer.
The image in RGB format. Final dimension denotes channels.
The name of the illuminant (the function is NOT case sensitive).
The aperture angle of the observer.
The image in Lab format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
RGB is a device-dependent color space so, if you use this function, be sure that the image you are analyzing has been mapped to the sRGB color space.
This function uses rgb2xyz and xyz2lab. By default Observer= 2A, Illuminant= D65. CIE XYZ tristimulus values x_ref=95.047, y_ref=100., z_ref=108.883. See function get_xyz_coords for a list of supported illuminants.
https://en.wikipedia.org/wiki/Standard_illuminant


RGB to RGB CIE color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in RGB CIE format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
https://en.wikipedia.org/wiki/CIE_1931_color_space


RGB to XYZ color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in XYZ format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
The CIE XYZ color space is derived from the CIE RGB color space. Note however that this function converts from sRGB.
https://en.wikipedia.org/wiki/CIE_1931_color_space


RGB to YCbCr color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in YCbCr format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
Y is between 16 and 235. This is the color space commonly used by video codecs; it is sometimes incorrectly called “YUV”.
https://en.wikipedia.org/wiki/YCbCr


RGB to YDbDr color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in YDbDr format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
This is the color space commonly used by video codecs. It is also the reversible color transform in JPEG2000.
https://en.wikipedia.org/wiki/YDbDr


RGB to YIQ color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in YIQ format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).


RGB to YPbPr color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in YPbPr format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
https://en.wikipedia.org/wiki/YPbPr


RGB to YUV color space conversion.
The image in RGB format. Final dimension denotes channels.
The image in YUV format. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
Y is between 0 and 1. Use YCbCr instead of YUV for the color space commonly used by video codecs, where Y ranges from 16 to 235.
https://en.wikipedia.org/wiki/YUV


RGBA to RGB conversion using alpha blending [1].
The image in RGBA format. Final dimension denotes channels.
The color of the background to blend the image with (3 floats between 0 to 1 - the RGB value of the background).
The image in RGB format. Same dimensions as input.
If rgba is not at least 2-D with shape (…, 4).
https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending


RGB CIE to RGB color space conversion.
The image in RGB CIE format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If rgbcie is not at least 2-D with shape (…, 3).
https://en.wikipedia.org/wiki/CIE_1931_color_space


RGB to stain color space conversion.
The image in RGB format. Final dimension denotes channels.
The stain separation matrix as described by G. Landini [1].
The image in stain color space. Same dimensions as input.
If rgb is not at least 2-D with shape (…, 3).
Stain separation matrices available in the color module and their respective colorspace:
This implementation borrows some ideas from DIPlib [2], e.g. the compensation using a small value to avoid log artifacts when calculating the Beer-Lambert law.
https://web.archive.org/web/20160624145052/http://www.mecourse.com/landinig/software/cdeconv/cdeconv.html
https://github.com/DIPlib/diplib/
A. C. Ruifrok and D. A. Johnston, “Quantification of histochemical staining by color deconvolution,” Anal. Quant. Cytol. Histol., vol. 23, no. 4, pp. 291–299, Aug. 2001.


XYZ to CIE-LAB color space conversion.
The image in XYZ format. Final dimension denotes channels.
The name of the illuminant (the function is NOT case sensitive).
The aperture angle of the observer.
The image in CIE-LAB format. Same dimensions as input.
If xyz is not at least 2-D with shape (…, 3).
If either the illuminant or the observer angle is unsupported or unknown.
By default Observer= 2A, Illuminant= D65. CIE XYZ tristimulus values x_ref=95.047, y_ref=100., z_ref=108.883. See function get_xyz_coords for a list of supported illuminants.
http://www.easyrgb.com/index.php?X=MATH&H=07
https://en.wikipedia.org/wiki/Lab_color_space


XYZ to RGB color space conversion.
The image in XYZ format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If xyz is not at least 2-D with shape (…, 3).
The CIE XYZ color space is derived from the CIE RGB color space. Note however that this function converts to sRGB.
https://en.wikipedia.org/wiki/CIE_1931_color_space


YCbCr to RGB color space conversion.
The image in YCbCr format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If ycbcr is not at least 2-D with shape (…, 3).
Y is between 16 and 235. This is the color space commonly used by video codecs; it is sometimes incorrectly called “YUV”.
https://en.wikipedia.org/wiki/YCbCr


YDbDr to RGB color space conversion.
The image in YDbDr format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If ydbdr is not at least 2-D with shape (…, 3).
This is the color space commonly used by video codecs, also called the reversible color transform in JPEG2000.
https://en.wikipedia.org/wiki/YDbDr


YIQ to RGB color space conversion.
The image in YIQ format. Final dimension denotes channels.
The image in RGB format. Same dimensions as input.
If yiq is not at least 2-D with shape (…, 3).