pandas.Series

class pandas.Series(data=None, index=None, dtype=None, name=None, copy=False, fastpath=False)

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

Labels need not be unique but must be any hashable type. The object supports both integer- and label-based indexing and provides a host of methods for performing operations involving the index. Statistical methods from ndarray have been overridden to automatically exclude missing data (currently represented as NaN)

Operations between Series (+, -, /, , *) align values based on their associated index values– they need not be the same length. The result index will be the sorted union of the two indexes.

Parameters :

data : array-like, dict, or scalar value

Contains data stored in Series

index : array-like or Index (1d)

Values must be unique and hashable, same length as data. Index object (or other iterable of same length as data) Will default to np.arange(len(data)) if not provided. If both a dict and index sequence are used, the index will override the keys found in the dict.

dtype : numpy.dtype or None

If None, dtype will be inferred

copy : boolean, default False

Copy input data

Attributes

T support for compatiblity
at
axes
base
blocks Internal property, property synonym for as_blocks()
data
dtype
dtypes for compat
empty True if NDFrame is entirely empty [no items]
flags
ftype
ftypes for compat
iat
iloc
imag
is_time_series
ix
loc
ndim
real
shape
size
strides
values Return Series as ndarray
weekday
is_copy  
str  

Methods

abs() Return an object with absolute value taken.
add(other[, level, fill_value, axis]) Binary operator add with support to substitute a fill_value for missing data
add_prefix(prefix) Concatenate prefix string with panel items names.
add_suffix(suffix) Concatenate suffix string with panel items names
align(other[, join, axis, level, copy, ...]) Align two object on their axes with the
all([axis, out]) Returns True if all elements evaluate to True.
any([axis, out]) Returns True if any of the elements of a evaluate to True.
append(to_append[, verify_integrity]) Concatenate two or more Series. The indexes must not overlap
apply(func[, convert_dtype, args]) Invoke function on values of Series. Can be ufunc (a NumPy function
argmax([axis, out, skipna]) Index of first occurrence of maximum of values.
argmin([axis, out, skipna]) Index of first occurrence of minimum of values.
argsort([axis, kind, order]) Overrides ndarray.argsort.
as_blocks([columns]) Convert the frame to a dict of dtype -> Constructor Types that each has
as_matrix([columns]) Convert the frame to its Numpy-array matrix representation. Columns
asfreq(freq[, method, how, normalize]) Convert all TimeSeries inside to specified frequency using DateOffset
asof(where) Return last good (non-NaN) value in TimeSeries if value is NaN for
astype(dtype[, copy, raise_on_error]) Cast object to input numpy.dtype
at_time(time[, asof]) Select values at particular time of day (e.g.
autocorr() Lag-1 autocorrelation
between(left, right[, inclusive]) Return boolean Series equivalent to left <= series <= right. NA values
between_time(start_time, end_time[, ...]) Select values between particular times of the day (e.g., 9:00-9:30 AM)
bfill([axis, inplace, limit, downcast]) Synonym for NDFrame.fillna(method=’bfill’)
bool() Return the bool of a single element PandasObject
clip([lower, upper, out]) Trim values at input threshold(s)
clip_lower(threshold) Return copy of the input with values below given value truncated
clip_upper(threshold) Return copy of input with values above given value truncated
combine(other, func[, fill_value]) Perform elementwise binary operation on two Series using given function
combine_first(other) Combine Series values, choosing the calling Series’s values
compound([axis, skipna, level]) Return the compound percentage of the values for the requested axis
consolidate([inplace]) Compute NDFrame with “consolidated” internals (data of each dtype
convert_objects([convert_dates, ...]) Attempt to infer better dtype for object columns
copy([deep]) Make a copy of this object
corr(other[, method, min_periods]) Compute correlation with other Series, excluding missing values
count([level]) Return number of non-NA/null observations in the Series
cov(other[, min_periods]) Compute covariance with Series, excluding missing values
cummax([axis, dtype, out, skipna]) Return cumulative max over requested axis.
cummin([axis, dtype, out, skipna]) Return cumulative min over requested axis.
cumprod([axis, dtype, out, skipna]) Return cumulative prod over requested axis.
cumsum([axis, dtype, out, skipna]) Return cumulative sum over requested axis.
describe([percentile_width]) Generate various summary statistics of Series, excluding NaN
diff([periods]) 1st discrete difference of object
div(other[, level, fill_value, axis]) Binary operator truediv with support to substitute a fill_value for missing data
divide(other[, level, fill_value, axis]) Binary operator truediv with support to substitute a fill_value for missing data
dot(other) Matrix multiplication with DataFrame or inner-product with Series
drop(labels[, axis, level, inplace]) Return new object with labels in requested axis removed
drop_duplicates([take_last, inplace]) Return Series with duplicate values removed
dropna([axis, inplace]) Return Series without null values
duplicated([take_last]) Return boolean Series denoting duplicate values
eq(other)
equals(other) Determines if two NDFrame objects contain the same elements. NaNs in the
ffill([axis, inplace, limit, downcast]) Synonym for NDFrame.fillna(method=’ffill’)
fillna([value, method, axis, inplace, ...]) Fill NA/NaN values using the specified method
filter([items, like, regex, axis]) Restrict the info axis to set of items or wildcard
first(offset) Convenience method for subsetting initial periods of time series data
first_valid_index() Return label for first non-NA/null value
floordiv(other[, level, fill_value, axis]) Binary operator floordiv with support to substitute a fill_value for missing data
from_array(arr[, index, name, copy, fastpath])
from_csv(path[, sep, parse_dates, header, ...]) Read delimited file into Series
ge(other)
get(label[, default]) Returns value occupying requested label, default to specified missing value if not present.
get_dtype_counts() Return the counts of dtypes in this object
get_ftype_counts() Return the counts of ftypes in this object
get_value(label) Quickly retrieve single value at passed index label
get_values() same as values (but handles sparseness conversions); is a view
groupby([by, axis, level, as_index, sort, ...]) Group series using mapper (dict or key function, apply given function
gt(other)
head([n]) Returns first n rows
hist([by, ax, grid, xlabelsize, xrot, ...]) Draw histogram of the input series using matplotlib
idxmax([axis, out, skipna]) Index of first occurrence of maximum of values.
idxmin([axis, out, skipna]) Index of first occurrence of minimum of values.
iget(i[, axis]) Return the i-th value or values in the Series by location
iget_value(i[, axis]) Return the i-th value or values in the Series by location
interpolate([method, axis, limit, inplace, ...]) Interpolate values according to different methods.
irow(i[, axis]) Return the i-th value or values in the Series by location
isin(values) Return a boolean Series showing whether each element
isnull() Return a boolean same-sized object indicating if the values are null
item()
iteritems() Lazily iterate over (index, value) tuples
iterkv(*args, **kwargs) iteritems alias used to get around 2to3. Deprecated
keys() Alias for index
kurt([axis, skipna, level, numeric_only]) Return unbiased kurtosis over requested axis
kurtosis([axis, skipna, level, numeric_only]) Return unbiased kurtosis over requested axis
last(offset) Convenience method for subsetting final periods of time series data
last_valid_index() Return label for last non-NA/null value
le(other)
load(path) Deprecated.
lt(other)
mad([axis, skipna, level]) Return the mean absolute deviation of the values for the requested axis
map(arg[, na_action]) Map values of Series using input correspondence (which can be
mask(cond) Returns copy whose values are replaced with nan if the
max([axis, skipna, level, numeric_only]) This method returns the maximum of the values in the object.
mean([axis, skipna, level, numeric_only]) Return the mean of the values for the requested axis
median([axis, skipna, level, numeric_only]) Return the median of the values for the requested axis
min([axis, skipna, level, numeric_only]) This method returns the minimum of the values in the object.
mod(other[, level, fill_value, axis]) Binary operator mod with support to substitute a fill_value for missing data
mode() Returns the mode(s) of the dataset.
mul(other[, level, fill_value, axis]) Binary operator mul with support to substitute a fill_value for missing data
multiply(other[, level, fill_value, axis]) Binary operator mul with support to substitute a fill_value for missing data
ne(other)
nonzero() numpy like, returns same as nonzero
notnull() Return a boolean same-sized object indicating if the values are
nunique() Return count of unique elements in the Series
order([na_last, ascending, kind]) Sorts Series object, by value, maintaining index-value link
pct_change([periods, fill_method, limit, freq]) Percent change over given number of periods
plot(series[, label, kind, use_index, rot, ...]) Plot the input series with the index on the x-axis using matplotlib
pop(item) Return item and drop from frame.
pow(other[, level, fill_value, axis]) Binary operator pow with support to substitute a fill_value for missing data
prod([axis, skipna, level, numeric_only]) Return the product of the values for the requested axis
product([axis, skipna, level, numeric_only]) Return the product of the values for the requested axis
ptp([axis, out])
put(*args, **kwargs)
quantile([q]) Return value at the given quantile, a la scoreatpercentile in
radd(other[, level, fill_value, axis]) Binary operator radd with support to substitute a fill_value for missing data
rank([method, na_option, ascending]) Compute data ranks (1 through n).
ravel([order])
rdiv(other[, level, fill_value, axis]) Binary operator rtruediv with support to substitute a fill_value for missing data
reindex([index]) Conform Series to new index with optional filling logic, placing
reindex_axis(labels[, axis]) for compatibility with higher dims
reindex_like(other[, method, copy, limit]) return an object with matching indicies to myself
rename([index]) Alter axes input function or functions.
rename_axis(mapper[, axis, copy, inplace]) Alter index and / or columns using input function or functions.
reorder_levels(order) Rearrange index levels using input order.
repeat(reps) See ndarray.repeat
replace([to_replace, value, inplace, limit, ...]) Replace values given in ‘to_replace’ with ‘value’.
resample(rule[, how, axis, fill_method, ...]) Convenience method for frequency conversion and resampling of regular time-series data.
reset_index([level, drop, name, inplace]) Analogous to the pandas.DataFrame.reset_index() function, see
reshape(*args, **kwargs) See numpy.ndarray.reshape
rfloordiv(other[, level, fill_value, axis]) Binary operator rfloordiv with support to substitute a fill_value for missing data
rmod(other[, level, fill_value, axis]) Binary operator rmod with support to substitute a fill_value for missing data
rmul(other[, level, fill_value, axis]) Binary operator rmul with support to substitute a fill_value for missing data
round([decimals, out]) Return a with each element rounded to the given number of decimals.
rpow(other[, level, fill_value, axis]) Binary operator rpow with support to substitute a fill_value for missing data
rsub(other[, level, fill_value, axis]) Binary operator rsub with support to substitute a fill_value for missing data
rtruediv(other[, level, fill_value, axis]) Binary operator rtruediv with support to substitute a fill_value for missing data
save(path) Deprecated.
select(crit[, axis]) Return data corresponding to axis labels matching criteria
set_value(label, value) Quickly set single value at passed label.
shift([periods, freq, axis]) Shift index by desired number of periods with an optional time freq
skew([axis, skipna, level, numeric_only]) Return unbiased skew over requested axis
sort([axis, kind, order, ascending]) Sort values and index labels by value, in place.
sort_index([ascending]) Sort object by labels (along an axis)
sortlevel([level, ascending]) Sort Series with MultiIndex by chosen level. Data will be
squeeze() squeeze length 1 dimensions
std([axis, skipna, level, ddof]) Return unbiased standard deviation over requested axis
sub(other[, level, fill_value, axis]) Binary operator sub with support to substitute a fill_value for missing data
subtract(other[, level, fill_value, axis]) Binary operator sub with support to substitute a fill_value for missing data
sum([axis, skipna, level, numeric_only]) Return the sum of the values for the requested axis
swapaxes(axis1, axis2[, copy]) Interchange axes and swap values axes appropriately
swaplevel(i, j[, copy]) Swap levels i and j in a MultiIndex
tail([n]) Returns last n rows
take(indices[, axis, convert]) Analogous to ndarray.take, return Series corresponding to requested
to_clipboard([excel, sep]) Attempt to write text representation of object to the system clipboard
to_csv(path[, index, sep, na_rep, ...]) Write Series to a comma-separated values (csv) file
to_dense() Return dense representation of NDFrame (as opposed to sparse)
to_dict() Convert Series to {label -> value} dict
to_frame([name]) Convert Series to DataFrame
to_hdf(path_or_buf, key, **kwargs) activate the HDFStore
to_json([path_or_buf, orient, date_format, ...]) Convert the object to a JSON string.
to_msgpack([path_or_buf]) msgpack (serialize) object to input file path
to_period([freq, copy]) Convert TimeSeries from DatetimeIndex to PeriodIndex with desired
to_pickle(path) Pickle (serialize) object to input file path
to_sparse([kind, fill_value]) Convert Series to SparseSeries
to_string([buf, na_rep, float_format, ...]) Render a string representation of the Series
to_timestamp([freq, how, copy]) Cast to datetimeindex of timestamps, at beginning of period
tolist() Convert Series to a nested list
transpose() support for compatiblity
truediv(other[, level, fill_value, axis]) Binary operator truediv with support to substitute a fill_value for missing data
truncate([before, after, axis, copy]) Truncates a sorted NDFrame before and/or after some particular
tshift([periods, freq, axis]) Shift the time index, using the index’s frequency if available
tz_convert(tz[, copy]) Convert TimeSeries to target time zone
tz_localize(tz[, copy, infer_dst]) Localize tz-naive TimeSeries to target time zone
unique() Return array of unique values in the Series. Significantly faster than
unstack([level]) Unstack, a.k.a.
update(other) Modify Series in place using non-NA values from passed
valid([inplace])
value_counts([normalize, sort, ascending, bins]) Returns Series containing counts of unique values. The resulting Series
var([axis, skipna, level, ddof]) Return unbiased variance over requested axis
view([dtype])
where(cond[, other, inplace, axis, level, ...]) Return an object of same shape as self and whose corresponding
xs(key[, axis, level, copy, drop_level]) Returns a cross-section (row(s) or column(s)) from the Series/DataFrame.