L1_DataFrames_I
L1_DataFrames_I
11 DATAFRAME
In the previous sections, we have discussed series in detail. One limitation of
not able to handle 2D or multidimensional data related to real time. series is that it is
For such tasks, Python Pandas provides another data structure called
dataframe.
Dataframe object of Pandas can store 2D heterogeneous data. It is a
structure, just like any table (with rows &columns). Dataframe is similar to
SQL tables. While working with Pandas, datora
dataframe is the most commonly-used data structure
two-dimspreadsheet
ensional s
The basic features of
dataframe are: Columns
() Columns can be of different types, i.e., it is A B C D
possible to have any kind of data in columns, E
olo 0 0
.e., numeric, string or floating point, etc. SMOM 0 0 0
(ii) Size of dataframe is mutable, i.e., the
of rows and columns can be
number 0 0
increased or
decreased any time. 0
(iii) Its data/values are also mutable and can
be changed any time.
(iv) Labelled axes
(rows/columns).
(v) Arithmetic operations can be
performed on rows and columns.
(vi) Indexes may constitute
numbers, strings or letters.
1.11.1 Creation of Dataframe
Before creating a dataframe, we must
understand the layout of dataframe.
The table given below
represents the data of students with their marks along with
grades. The data is represented in rows and columns. Each column the respective
(like Name, Marks, Grade) and each represents an attribute
row represents record of a
student.
column names
Name Marks Grade
Vijaya 80 B1
1 Rahul 92
Row/Record
A2
2
Index label Meghna 67 C
3 Radhika 95 A1
4 Shaurya 97 A1
Creating an Empty Dataframe
Creatingadataframe begins with the creation of anempty
DataFrame) method is used. To display a dataframe,the dataframe. To create an empty dataframe,
is used. command print (<dataframe name>)
prog_dfl.py-CUsers/preeti/AppData/loc
File Edit Format Run
Options Window Help
#Creating an Empty dataframe
import pandas as pd
dfl =pd. DataFrame ()
print (dfl)
RESTART: C:/Users/preeti
Empty DataFrame
Columns: )
As is evident from the output, columns and index are empty since no argument has been passed
to the method DataFrame().
Its syntax is:
pandas. DataFrame (data, index, columns)
Here,
data: The data can be taken in the form of a ndarray, series, lists, dict and even another
dataframe.
index: For the row labels, it defines the index to be usedfor the resulting frame which is optional.
If the index is not specified, by default, it willtake the value of the index from 0to n-1, where nis
the total number of rows in the given data set.
columns: This attribute is used to provide column names in the dataframe. If the column name
is not specified, by default, it will take the value of the index from 0 to n-1, where n is the total
number of columns in the given data set.
Let us see an example to understand the basic components of a Pandas dataframe.
Example: Carefully observe the following code:
import pandas as pd
Yearl={'Q1':5000, 'Q2':8000, 'Q3':12000, 'Q4': 18000}
Year2={'A' :13000, 'B':14000, 'C':12000}
totSales= {1:Yearl,2:Year2}
df=pd. DataFrame (totSales)
print (df)
2. Series
3. Dictionary
4. NumPy ndarrays
1. Creating Dataframe from Lists
using lists. The list is passed as an argument
The simplest form of generating dataframe is displayed as
converted into a dataframe with elements
to DataFrame() method and gets The default column label is 0. We can
automatically created by Pandas.
columns and index
column index values for arranging elements in the form of rows and
also provide row and
columns.
Example 1: To create a dataframe from list.
Python 3.7.0 Shell
File Edit Shell Debug Options
Window Help
>>> import pandas as pd
>>> listl (10, 20,30, 40,50)
>>> dfl
-pd.DataFrame
>>> print (dfl) (1ist1)
0) 10 Column label
1 20
2 30
3 40 + Index value generated
4 50 automatically
Ln: 31 Col: 4
1 2
2 3
3 4
4 5
(ii) To create a resultant dataframe from the above two created series, pass them as a
dictionary to DataFrame() method.
>>> df-pd. Data Frame (( Ser1':3, 'Ser2' 132) )
>>> df
Serl Ser2
1 10
1 2 20
2 3 30
3 4 40
5 50
Lx 11 Col: 4
As is evident from the output obtained, since no
index values have been
DataFrame) method, therefore, all the keys of the dictionary shall becomepassed
to the
names of the dataframe and the values represented in the the column
shall become the values of the dataframe columns. form of lists in the dictionary
(b) Creating a Dataframe from Dictionary of series
A dictionary of series can also be
used to create a dataframe. For example, Stud
isa dictionaryof series _Result
containing names and marks of four students in three subjects.
Le prog
#Creating dictseriesdf1.py-CUsers/pre ti/AppDadictionary
Fle Edt Formut Run Options Window Help
a
import numpy as np
dataframe from ta/local/Programs/Python/Python37-32/prog_dict seriesdf1.py
of series
(3.7.0)
import pandas as pd
n=pd.Series (['Rinku', 'Deep', ' Shaurya , "Radhika'))
Eng=pd.Series ( (89, 78,89, 90])
Eco=pd.Series ( (87,80,60,84))
IP=pd.series ([89, 78,67,90])
#Creating dictionary using series variables as
stud Result= ("Name":n, values
Creating dataframe "English" : Eng, "Economics" :Eco, "Informatics
df=pd.DataFrame
print (df)
(Stud Result) RESTART:
Practices":IP)
riesdll .py
Name
Rinku
Deep
C:/Users/preeti/AppDatInformatics
English
89
78
a/Local/ProgrPractices
Economics87
80
ams / Python
Shaurya
Radhika
89
90
60 78
>>> 84 67
90
Alternatively, we can also create a
dataframe from. a
dictionary using Series() methoddictionary
the values to the of
as shown inseries by directly passing
Implementation: the following
Practical Implementation-23
Practical
To create a
dataframe from adictionary of series by
using Series() method. directly passing the values to the
prog_dict seriesd12.py- dictionary
File Edk Format Run
import pandas as pd C/Users/pre ti/AppData/LocaV/Programs/Python/Python37-32/prog_dict.
Options Window Help
Practical Implementation-24
To create a dataframe by passing a list of dictionaries.
df_dictlist. D
L prog_df dictlistpy-C/Users/preeti/AppData/Local/Programs/Python/Python37-32/prog
File Edit Format Run Options Window Help
#Creating a dataframe by passing a list of dictionaries
import pandas
newstudent as pd :67, 'Ritu':78, 'Ajay':75, 'Pankaj':88, 'Aditya' :92),
=[{'Rinku'
{'Rinku ':77, 'Ritu':58,'Ajay' :87, 'Pankaj' :65},
{'Rinku':88, 'Ajay':67, 'Pankaj' :74, 'Aditya':70}]
newdf pd.DataFrame (newstudent)
print (newdf)
RESTART: C:\Users\ User2\AppData\Local\Programs\Python\Python39\datafra
me chlinserneW.py
Rinku Ritu Ajay Pankaj Aditya
67 78.0 75 88 92.0
1 77 58.0 87 65 NaN
2 88 NaN 67 74 70.0
Ln: 12 Col: 4
places.
As shown in the output window, NaN (Not a Number) is automatically added in missing
4. Creating a Dataframe using NumPy ndarray
We can create a dataframe using NumPy ndarray by importing NumPy module in our program.
Practical Implementation-25
To create a dataframe from NumPy ndarray.
DataframeCh-1.py - CAUsers\User2\AppData\Local\ Programs\Python\Python39\DataframeC. X
>>>
Ln 11 Cl: 4
eprog.dfi ributespy-CUsers/preeti/AppData/Local/Programs/Python/Python37-32/prog.d
Fle Edt Fomt Run Opions Wndow Hep
import pandas as pd
1. index
3. axes
This attribute is used to fetch both index and column names.
Syntax:
<DataFrameObject>. <axes>
>>>print (df. axes)
>>> df. axes
[Index('Accountancy', 'IP', 'Economics', 'English'], dtype=' object'),
Index (['2018', '2019', '2020'J, dtype=' object')]
4. dtypes
This attribute is used to fetch the data type of each column in the dataframe.
Syntax:
<DataFrame Object>, <dtypes>
>>>print (df. dt ypes)
>>> df.dtypes
2018 float64
2019 float64
2020 float64
dtype: object
5. size
This attribute is used to fetch the size of the dataframe, which is the product of the number
of rows and columns. It represents the number of elements in the dataframe and always
returns an integer value.
of our
Here, in our example, we have 4 rows and 3 columns, So 4*3, ie., 12 is the size
dataframe.
Syntax:
<DataFrameObject>. <size>
>>>print (df.size)
>>> df. size
12
6. shape
i.e., the number of rows
This attribute alsogives youthe size but it also mentions its shape,
and number of columns of the dataframe.
Syntax:
<DataFrameObject>. <shape>
>>>print (df . shape)
>>> df. shape
(4, 3)
This attribute is used to fetch the dimensions (number of axes) of the given
i.e., whether it is 1D, 2D, or 3D. Thus, fora 2D dataframe, it will return the output as 2 dataframe,
Syntax:
<DataFrame Obj ect>. <ndim>
print (df. ndim)
>>> df. ndim
2
8. empty
This attribute gives you a boolean output in the form of True or False by which we can fnd
out if there is any empty or missing value present in the dataframe.
Syntax:
<DataFrameObject>. <empty>
>>> print (df.empty)
False
Apart from the above attribute, we have a method called isna () in Pandas that can check the
presence of NaNs (Not a Number) in dataframes.
Syntax:
<DataFrameObject>. isna()>
e prog dfi_tributes,py
-CUsers/preeti/AppData/loca\/Programs/Python/Python37-32/prog_.
File Edit Format Run Options Window Help
import pandas as pd
dict={ "' 2018': (85.4,88.2,80.3, 79.0], '2019: [77.9, 80.5,78.6,
'2020:(86.5,90.0, 77.5,80.5]) 76.2] ,
10. Count
This attribute calculates the number of non-null or non-missing values in each column.
Syntax:
<DataFrame Object>.<Count>
>>>print (df. count ())
- RESTART: C:/Users/Editor AI and CS 1/AppData/ Local/Programs/Python/Python31l/d
fdict.py 4
2018
2019 4
2020 4
dtype: int64
Practical Implementation-26
To create an indexed dataframe using lists.
format:
You can give index to the dataframe explicitly in the following
['Sno1','Sno2', 'Sno3','Sno4', 'Sno5'])
df = pd. DataFrame (student, index=
'Sno2','Sno3', 'Sno4, 'Sno5')
>>> df =pd.DataFrame (student, index=['Snol',
>>> df
Name English Economics IP Accounts
78 78 77
Snol Rinku 67
67 70
Sno2 Ritu 78
89 98 80
Sno3 Ajay 75
90 90 67
Sno4 Pankaj 88
56 87 86
Sno5 Aditya 92
>>>
as
the default index value starting from 0 has been replaced by serial number
In the given case, dataframe.
the
the index for all the records in
Practical Implementation-27
To change the Index Column. Pandas
index is displayed from 0 to n-1, where n is the total number of records.
By default,the dataframe as the
provides us with the flexibility to select the other column present in the index() method
also 0,1,2..and n. This can be done using set
index column instead of the traditional
in the following format:
Syntax: inplace=True)
df.set index (<column name>, 1.31
Data Handling using Pandas
Here,
column_name: is the name of the column which is to be set as the index of the
Suppose we have to take Name as the index column. This is done as: dataframe.
DataFrame for student
Name English Economics IP
|Default index Rinku 67 78
Accounts
78 77
value Ritu 78 67 88 70
Ajay 75 89 98 80
Pankaj 88 90 90 67
Aditya 92 56 87 86
>>> df.set_index ('Name', inplace=True)
>>> df
Index column changed
English Economics IP Accounts
to Name Name
Rinku 67 78 78 77
Ritu 78 67 88 70
Ajay 79 89 98 80
Pankaj 88 90 90 67
Aditya
L>>>
92 56 87 86
add a
(label). In such a case, a row with thisrow of data with already
index label will be existing (duplicate) index value
>>> newdf.loc ['3']=[55, 66, 77,98,39]
>>> print (newdf)
updated/modified as shown below:
Aditya
92.0
Ajay Pankaj Rinku Ritu
75 88 67
1 NaN 87 78.0
65 77
2 70.0 67 58.0
74 88
55.0 66 NaN
77 98 39.0
If we try to add a row with
lesser values than the number of columns in the
in aValueError, with the
error message:
ValueError: Cannot set a row with mismatched columns. dataframe, it results
Similarly, if we try to adda column with lesser values
it results in a than the number of
ValueError, with the error message: rows in the
ValueError: Length of values does not match leng th of index.
An alternate method to add a new
DataFrame,
row in a dataframe is using .at
Syntax: attribute.
<df>, at [<row label>,:]=<new value (s)>
Example 4:
Name English Economics Informatics Practices
) Rinku 89 87 89
1 Deep 80
2 Shaurya 8 60 67
3 Radhi ka 90 84 90
>>> df.at [4,:]=("Geet",80,60,90]
>>> df
Name English Economics Informatics Practices
Rinku 89.0 87.0 89.0
1 Deep 78.0 80.0 78.0
2 Shaurya 89.0 60.0 67.0
3 Radhika 90.0 84.0 90.0
Geet 80.0 60.0 90.0
101
1 102
103 Default column name
104 as 0
4 105
Practical Implementation-30
To rename a column name.
>> df. columns=['Admno'] #Renaming the col umn name to Admno
>> df
Admno
101
102
103
104
105
In the above Practical Implementation, we have learnt to rename the only given column in
In Pandas, this iss done by using the function rename() as exhibited in the Practical
below.
Practical Implementation-31
Implementa iy
Create a dataframe student with columns such as name of the student, student's marks in
IP and BST. Also, rename the column Name as Nm and IP as Informatics Practices
progrenme dfipy- CAUsers preet\ AppData|Loca\ Programs\Python Python37-32\prog renme_ df,py (3.7) - ox
subieco
File Edt Fomat Run Options Window Help
#Renaming columns in a dataframe
import pandas as pd
s=[['Rinku',79, 72], ('Ritu',75, 73], ('Ajay', 80,76])
print ('Series Generated As:")
print (s)
df-pd. DataFrame (s, columns=('Name', 'IP', 'BST')
print (df)
f.rename (columns={'Name':'Nm','IP':'Informatics Practices'), inplace=True)
print (df) >>>
RESTART : C:\Users\preeti\AppData\Local\Programs\Python\
f-py L 14 Col:0
Series Generated As:
Rinku', 79, 72], ('Ritu', 75, 73], ('Ajay', 80, 76]]
Name IP BST
Rinku 79 72
1 Ritu 75 73
2 Ajay 80 76
Nm Informatics Practices BST
0 Rinku 79 72
Ritu 75 73
Ajay 80 76
df ['Average'] = df [ 'Total']
/3
>>> df ['Average']=df ('Total' ]/3
>>> df
Admno Name Physics Chemistry Maths Total Average
84.666667
89 77 88 254
101 Shruti 77.333333
78 89 65 232
102 Gunjan 79 218 72.666667
65 74
2 103 Tanya 183 61.000000
45 60 78
3 104 Kirti 58 169 56.333333
105 Vineet 55 56
as ith Putho
>>>
As observed from the output displayed, all the rows of the first
(Name) and fifth
are shown respectively. Here, [:] signifies all rows and [1,5] indicates 1* and 5th colur (Total)
index
This was for selective columns. If you wish to
extract a range of columns, suppose the firet columns
columns of the dataframe df, then the command shall be [0:5] as shown below:
>>> df.iloc[:,0:5)
Admno Name Physics Chemistry Maths
101 Shruti 89 77 88
1 102 Gunjan 78 89 65
2 103 Tanya 65 74 79
3 104 Kirti 45 60 78
4 105 Vineet 55 56 58
Practical Implementation-34
Implementation of iloc and loc attribute with respect to 'student' dataframe.
Là prog _selectdf_yowscolspy-
C/Users/preeti/AppData/local/Programs/Python/Python37-32/prog_selec. -
File Edt Format Run Optio Window Help
#Selecting/Accessing Rows/Column s from a DataFrame
import pandas as pd
student= ("Roll No": [1, 2, 3,4,5),
"Name":['Rinku', 'Deep', 'Shaurya','Radhika', 'Rohit'),
"English" :(89, 78,89,90,79),
"Economics": [87,80,60,84,77),
"IP" : (89, 78,67,90,92))
df-pd.DataFrame (student)
print (df)
#Displaying row index 0 to 2
print (df.iloc [0:3])
#Displaying the contents from roW 1ndex 0 to 2 and column index 0 to 2
print (df.iloc [0:3,0:3])
#Displaying the contents of DataFrame using loc
#location name from 1 to 3
8.
print (df. loc [1 :3])
Lr 20 Cot 0
RESTART: C:/Users/preeti/AppDat a/ Local/Programs
f_rowscols .py
Roll No Name Engl ish Economics IP
1 Rinku 87
1 2 Deep 78 80
2 3 Shaurya 60 67
3 4 Radhika 90 84 90
4 5 Rohit 79 77 92
Roll NO Name English Economics I
0 1 Rinku 89 87 89
1 2 Deep 78 80 78
3 89 60 67
Shaurya
Roll No Name English
1 Rinku 89
2 Deep 78
3 Shaurya 89
RollNo Name English Economics IP
1 2 Deep 80 78
2 3 Shaurya 89 60 67
3 4 Radhika 90 84 90
>>>
Itssyntax is:
drop (1abels, axis-1 ,inplace-True)
axis=1 means
It will return a new dataframe with the column(s) deleted or removed.
Column and 0stands for Row. By default, the value of axis is 0.
|>>> df
Adnno Name Physics Chemistry Maths Total Average
89 77 254 84.666667
101 Shruti
78 89 65 232 77.333333
102 Gunjan 218 72.666667
65 74 79
103 Tanya 183 61.000000
Kirti 45 60 78
104 169 56.333333
105 Vineet 55 56 58
>>> del df[ 'Average']
>>> df
Admno Name Physics Chemistry Maths Total
89 77 88 254
101 Shruti
78 89 65 232
102 Gunjan 79 218
65 74
2 103 Tanya
45 60 78 183
3 104 Kirti
55 56 58 169
105 Vineet
>>> df.pop('Total')
254
232
2 218
3 183
169
Name: Total, dtype: int64
>>> df.drop('Admno',axis=1)
Name Physics Chemistry Maths
0 Shruti 77 89
7 89 65
1 Gunjan
65 74 79
Tanya
3 45 60 78
Kirti
55 56 58
4 Vìneet
4
1.11.10Sorting Data in Dataframes*
We can sort the data present inside the dataframe by using sort_values()
arguments are passed--the first is the sorting field and the second is order of function. IfHeere, tm
not providing anything then, by default, the data shall be sorted inthe ascending sorting
order or it
explicitly defined as ascending =True; for descending, you have to give ascending =Fale can b
Practical Implementation-35
To sort the data of student dataframe based on marks.
prog. dt_sort.py - Users/preeti/AppData/Loca/Programs/Python/Python37-32/prog.df sortpy (3
Fie Edit Fomat Run Options Window Help
#Sorting the data in a dataframe
import pandas as pd
student marks -pd. series ({ 'Vijaya' :80, "'Rahul' :92, 'Meghna':67,
'Radhika':95, 'Shaurya' :97))
student age pd. Series ({'Vijaya':32, 'Rahul' :28, 'Meghna':30,
'Radhika' :25,' Shaurya':20))
student df =pd. DataFrame ({'Marks' :student markS,
print (student df) 'Age':student age))
#Sorting the data on the basis of marks in ascending order
print (student df. sort_values
(by=['Marks'))) #by keyword
#the field on the basis of which the
data is to be sorteddefines
print (student df . sort values(by= ('Marks'],
#in descending order of Marks ascending=False) ) #Sorted
Ln 19 Cok 0
*Not in
<DFObject>.iteritems()-It represents dataframe column-wise
syllabus but retained for extra learning.
row-wise, record by record.
1.42 Informatics Practices with Python-XIl
Let us see how the above two methods work. Consider three data series for yearly sales of
ABC Ltd.
>>>
RESTART: C:/Users/preeti/AppData/Local
rl.py
2015 2016 2017
Qtri 34500 44500 54500
Qtr2 45000 65000 42000
Qtr3 50000 70000 40000
Qtr4 39000 49000 89000
>>>
Using iterrows():
series. The
The first step has been completed by creating a dataframe from the quarterly sales
adding the following
next step is to display the record in the created dataframe one by one by
code in the previous code:
for (row, rowSeries) in df.iterrows () :
print ("RoWIndex :",row)
print ("Containing :")
print (rowseries)
Practical Implementation-36
Write a program to iterate over a
as per marks (as per the dataframe containing names and marks, then calculate
following criteria) and add them to the grade grades
Marks >=90 Grade A+ Name Mais column:
Marks 70 - 90 Grade A
Marks 60 - 70 Grade B
Soma 74
Marks 50 - 60 Grade C
Marks 40 - 50 Grade D Ab:
Marks < 40 Grade F
import pandas as pd
import numpy as np
names =
marks = pd.Series
(
['Sanjeev',
pd.Series ([76, 86, 55, 'Rajeev', 'Sanjay', 'Abhay')
stud =
df = {'Name': names, 'Marks': 54])
marks)
pd.DataFrame
df ['Grade'] (stud, columns= ['Name',
= np.NaN 'Marks )
print
print ("Initial
(df) values in
DataFrame:")
1stMarks
for
= [) #
Initialize an empty list
index, row in to store grades
df.iterrows
Mmarks = row['Marks']
if
():
marks >= 90:
elif 1stMarks.append
marks >= 70: ('A+')
elif 1stMarks.
Imarks append('A')
60:
1stMarks.append('
elif marks 50: B')
lstMarks.append
elif marks >= 40: ('C)
else 1stMarks.append('D') Initial values in
Name Marks DataFrame:
Grade
df ['Grade']
1stMarks.append('F)
1stMaarks
calculated grades to the Grade
print Assign the
0 Sanjeev
1 Rajeev
2 Sanjay
76
86
55
NaN
NaN
("\nDataFrame
Grades:")
print (df)
after column" Of
Calculation
3
Abhay 54
NaN
NaN
1.44
Informatics Practices with Python-Xi
1.13 BINARY OPERATIONS
In Mathematics, a binary operator is a function that combines two values to produce a new value.
The binary operator function could perform addition,subtraction and so on to return the new value.
Pandas Dataframe has several binary operator functions defined for combining two dataframes.
The binary operator functions return a new dataframe as a result of combining the two dataframes.
It is possible to perform add, subtract, multiply and divide operations on dataframe. Pandas
provides the methods add(), sub(), mul), div() and related functions radd(), rsub() for
carrying out binary operations on dataframe.
Out of these operations, add(), sub(), mul(0 and div() methods perform the basicmathematical
operations for addition, subtraction, multiplication and division of two dataframes.
The functions rsub and radd stand for right-side subtraction and right-side addition. rsub() function
subtracts each element in adataframe with the corresponding element in the other dataframe.
radd() function adds each element in a dataframe with the corresponding element in the other
dataframe. Since all these operations involve two dataframes to act upon,they are known as Binary
("bi' means 'two' and 'ary' means digits or Python dataframes in this case) operations.
Practical Implementation-37
To perform binaryoperations on two dataframes. We will perform operations on the following
two dataframesmarks obtained by two students in a class test:
student = {'Unit Test-1':(5,6, 8,3, 10], 'Unit Test-2' :[7,8,9, 6,15])
studentl ={"Unit Test-1':(3,3, 6,6, 8], 'Unit Test-2': [5,9,8,10, 5]}
G prog_binaryoptpy - C/Users/preeti/AppData/Loca/Programs/Python/Python37-32/progbina.
File Edit Fomat Run Options Window Help
$Binary operations on Dataframes
import pandas as pd
student ={'Unit Test-1':(5,6, 8,3,10], 'Unit Test-2': (7,8,9,6, 15] }
studentl ={'Unit Test-1':[3,3, 6, 6, 8], 'Unit Test-2': [5,9,8, 10,5])
ds pd. DataFrame (student)
As1 as). DataFrame (student1)
print
print (ds1)
print ("Subtraction")
print (ds.sub (ds1) )
print ("rsub")
print (ds.rsub (dsl) )
prínt ("Addition ")
print (ds.add (ds1) )
print ("radd")
print (ds.radd (ds1) )
print ("Multiplication")
print (ds.mul (ds1) )
print ("Division")
print (ds.div (dsl))
L 23 Cot 0
>>> rsub
RESTART: C:/Users/preeti/AppData/Local) Unít Test-1 Unit Test-2
-2 -2
opt
Unit Test-1 Unit Test-2 1 -3 1
5 2 -2 -1
6 3 3 4
Multiplication
8 4 -10 Unit Test-1 Unit Test-2
3 6 Addition 15 35
10 15 Unit Test-1 Unit Test-2 1 18 72
Unit Test-1 Unit Test-2 8 12
0 2 48 72
3 1 9 17
3 18 60
2 17
4 80 75
3 16
3 6 10 18 20
Division
4
8
radd
Unit Test-1 Unit Test-2
Subtraction 1.666667 1.400000
Unít Test-1 Unit Test-2
Unit Test-1 Unit Test-2 1 2.000000 0.888889
8 12
2
17 2 1.333333 1.125000
-1 1
3 0.600000
2 14 17 3 0.500000
2 2 1 3.000000
3 16 4 1.250000
-3 -4
4 10 18 20
2