Define pandas & its Function
Define Pandas:
In computer programming, pandas is a software library written for the Python programming language for data manipulation and analysis. In particular, it offers data structures and operations for manipulating numerical tables and time series. It is free software released under the three-clause BSD license.
So I have a small codes in which I use pandas :
1 program :
1-import pandas as pd (so we can use pandas any where as pd)
2-take a variable I take (a) as a variable which is equal to any variable.
3-Take another variable I take (myvar) as a variable which is equal to pd.Series(a)
[It can print numbers in series] which are in (a) variable
Code:
import pandas as pd
a = [1,2,3,4,5,6,7,8]
myvar = pd.Series(a)
print(myvar)
Output:
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
dtype: int64 Note:(first column is s.no and second column is your numbers)
2 program :
1-import pandas as pd (so we can use pandas any where as pd)
2-Make a dictionary with variable name (data) which is equal to some character and numbers for example ("weight":[1,2,3,4]) you can take multiple characters and numbers
3-Take another variable I take (myvar) as a variable which is equal to pd.DataFrame(data)
DataFrame is a 2-dimensional labeled data structure with columns of potentially different types
4-print (myvar)
Code:
import pandas as pd
data = {
"Weight": [120,390,400,300,500,400],
"duration":[30, 40, 50, 30, 20 ,10 ]
}
myvar = pd.DataFrame(data)
print(myvar)
Output:
Weight duration
0 120 30
1 390 40
2 400 50
3 300 30
4 500 20
5 400 10