Page 32 - Informatics_Practices_Fliipbook_Class12
P. 32
The above code replaces False with 'Store2' and True with 'Store1' in the higherSales series and prints
the updated series.
+: Element-wise addition of two series objects.
-: Element-wise subtraction of two series objects.
*: Element-wise multiplication of two series objects.
/: Element-wise division of two series objects.
//: Element-wise floor division of two series objects.
**: Element-wise exponent of two series object.
Let's Summarise
Series is a one-dimensional data structure of Pandas module that can accommodate objects of various types.
Ø
Series can be created using any sequence such as lists, Numpy array, and dictionary.
Ø
When we create a series object, Pandas replaces None by NaN.
Ø
The method astype() is used for typecasting the type of objects in a series.
Ø
The method append() can be used to combine two series objects.
Ø
The labels associated with values in a Pandas Series do not need to be unique.
Ø
The method head() returns first n records of the series, while the method tail() returns last n records
Ø
of the series.
The statistical summary of a series can be obtained by using the describe() method. For series comprising
Ø
numerical values, the output of the method includes the count of non-null observations, mean, standard
deviation, quartiles, minimum, and maximum values. For series comprising categorical values, the output of
the method includes total count of values, the number of unique values, the most frequently occurring value
(referred to as top), and the frequency of occurrence of the top value.
Aggregate and associated methods supported by Python series include the following:
Ø
• min(): Returns minimum value in the series.
• idxmin(): Returns index of minimum value in the series.
• max(): Returns maximum value in the series.
• idxmax(): Returns index of maximum value in the series.
• sum(): Returns sum of all the values in the series.
The transformation of a scalar quantity to an object compatible with the series is called broadcasting.
Ø
Broadcasting is a general term that transforms an object of lower dimension to an object of higher dimension
The membership operator in allows us to check whether a particular value is present in series. It returns
Ø
True if the value is present, and False otherwise.
For every element of the series, the method isnull() returns True if the value is missing from the series,
Ø
and False otherwise.
We can perform element-wise addition, subtraction, multiplication, and division of two series objects using
Ø
arithmetic operators: +, -, *, and /.
18 Touchpad Informatics Practices-XII

