pandas.Series Data Structure
Jump to navigation
Jump to search
A pandas.Series Data Structure is a Python-based indexed one-dimensional ndarray with labelable index valuels.
- Context
- It can (typically) be a pandas Data Structure.
- It can be an Timeseries Data Structure (where the index is timestamp values).
- It can support a pandas.Series Operation, such as describe(), keys(), ...
- It can support a pandas.DataFrame Attribute.
- It can be a pandas.Series v0.13.1.
- Example(s):
s = pandas.Series([-3.14, 'a text'])
s = pandas.Series([-3.14, 'a text'], index=['val1', 'val2'])
trange = pandas.date_range('1/1/2011', periods=72, freq='H')
ts = pandas.Series(numpy.random.randn(len(trange)), index=trange)
- Counter-Example(s)
- See: Perl Hash of Hashes.
References
2014
- http://pandas.pydata.org/pandas-docs/stable/dsintro.html#series
- Series is a one-dimensional labeled array capable of holding any data type (integers, strings, floating point numbers, Python objects, etc.). The axis labels are collectively referred to as the index. The basic method to create a Series is to call:
>>> s = Series(data, index=index)
Here, data can be many different things:- a Python dict
- an ndarray
- a scalar value (like 5)
- The passed index is a list of axis labels. Thus, this separates into a few cases depending on what data is: ...
- Series is a one-dimensional labeled array capable of holding any data type (integers, strings, floating point numbers, Python objects, etc.). The axis labels are collectively referred to as the index. The basic method to create a Series is to call:
- http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.html
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.