Series is a one-dimensional labeled array capable of holding data of any type (integer, string, float, python objects, etc.). The axis labels are collectively called index. https://www.tutorialspoint.com/python_pandas/python_pandas_series.htm
In [1]:
import numpy as np
import pandas as pd
In [2]:
ser1=pd.Series(data=["venkat","balaji","vijay"],index=["dm","ds","rpa"])
In [3]:
ser1
Out[3]:
In [4]:
ser2=pd.Series(["venkat","balaji","Praven"],["dm","ds","ajs"])
In [5]:
ser2
Out[5]:
In [6]:
ser1+ser2
Out[6]:
In [7]:
ser3=pd.Series(["a","c","d"])
In [8]:
ser3
Out[8]:
In [9]:
ser1["dm"]
Out[9]:
In [28]:
la = ['k','M1','z']
li = [10,20,30]
a1 = np.array(li)
di = {'a':10,'b':20,'c':30}
In [12]:
la
Out[12]:
In [13]:
li
Out[13]:
In [14]:
a1
Out[14]:
In [15]:
di
Out[15]:
In [16]:
la = ['a','b','c']
li = [10,20,30]
a1 = np.array(li)
di = {'a':10,'b':20,'c':30}
In [17]:
se1=pd.Series(di)
In [18]:
se1
Out[18]:
In [19]:
se2=pd.Series(data=li,index=la)
In [20]:
se2
Out[20]:
In [22]:
se2=pd.Series(li,la)
In [23]:
se2
Out[23]:
In [25]:
se2["c"]
Out[25]:
In [31]:
se3=pd.Series(la,di)
In [32]:
se3
Out[32]:
In [35]:
se4=pd.Series(a1,la)
In [36]:
se4
Out[36]:
No comments:
Post a Comment