PANDAS


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 = pd.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: From ndarray If data is an ndarray, index must be the same length as data. If no index is passed, one will be created having [0, ..., len(data) - 1].
example :

import pandas as pd
s=pd.Series(np.random.randn(5),index=['a','b','c']
print(s)

No comments:

Post a Comment