Basic concept of pandas

Basic concept of pandas

Pandas is an open-source they provide high performance, easy to use data structure and data analysis tools for python programing language. pandas is used in a wide range of fields including finance, economics, statics, analytics etc.

Advantages and disadvantages of pandas

Advantages- Less writting and more work done. less time taken. Easy to understand the data. They handle the large data.

Disadvantages- The functionality becomes extremely confusing and they create a probleam for beginners. Difficult syntax.

Series

Series is a one-dimensional labelled array capable of holding data of any type(integer,string,float).

import pandas as pd
import numpy as np
data = np.array(['a','b','c','d'])
s = pd.Series(data)
print(s)
0    a
1    b
2    c
3    d
dtype: object

In [30]:

import pandas as pd
import numpy as np
data = np.array(['a','b','c','d'])
s = pd.Series(data,index=[100,101,102,103])
print(s)
100    a
101    b
102    c
103    d
dtype: object

In [76]:

import pandas as pd
import numpy as np
s=pd.Series(5,index=[0,1,2,3,4,5,6,7])
print(s)
0    5
1    5
2    5
3    5
4    5
5    5
6    5
7    5
dtype: int64

Data frame

A data frame is a two-dimensional data structure

In [74]:

import pandas as pd
df= pd.DataFrame()
print(df)
Empty DataFrame
Columns: []
Index: []

In [72]:

import pandas as pd
list= [1,2,3,4,5]
df= pd.DataFrame(list)
df

 

Out[72]:

  0
0 1
1 2
2 3
3 4
4 5

 

In [71]:

import pandas as pd
data=[['ankita',21],['devshiri',21],['simran',21]]
df= pd.DataFrame(data,columns=['name','age'])
df

 

Out[71]:

  name age
0 ankita 21
1 devshiri 21
2 simran 21

Input:

import pandas as pd
data=[['ankita',21],['devshiri',21],['simran',21]]
df= pd.DataFrame(data,columns=['name','age'],dtype=float)
df

 

Out[70]:

  name age
0 ankita 21.0
1 devshiri 21.0
2 simran 21.0

 

In [69]:

a=np.reshape(np.arange(1,801),(200,4))
b=np.reshape(np.arange(1,601),(200,3))
c=np.concatenate((a,b),axis=1)
df =pd.DataFrame(c)
df

 

Out[69]:

  0 1 2 3 4 5 6
0 1 2 3 4 1 2 3
1 5 6 7 8 4 5 6
2 9 10 11 12 7 8 9
3 13 14 15 16 10 11 12
4 17 18 19 20 13 14 15
... ... ... ... ... ... ... ...
195 781 782 783 784 586 587 588
196 785 786 787 788 589 590 591
197 789 790 791 792 592 593 594
198 793 794 795 796 595 596 597
199 797 798 799 800 598 599 600

200 rows × 7 columns

Conclusion-

i have learned basic operation in pandas.

Improve your Business Analytics with our training data.

Better data is the key for the better products. We train you data for Machine Learning and better business analytics. We can annotate, collect, evaluate and translate any type of data in any language.