Series Manipulations
- 1 Concatenating two pandas series The method append() concatenates two pandas series objects and returns a new series. The new series retains the index from the input series objects. To produce a new series after comparing two elements from each series the method combine() to be used. 3 Nov 2019
- 2 Remove elements from a pandas Series using drop() and truncate() methods Elements from a pandas Series can be removed and new a Series object can be created through the methods drop() and truncate() by specifying the index and index labels of the series. 4 Nov 2019
- 3 Make every element of the series as a separate row The explode() method makes every element of a pandas Series instance as a separate row and returns a new Series. The method works for the elements of any sequence as well, which may present inside a Series instance. 3 Nov 2019
- 4 Retrieve elements from the head and tail of a Pandas Series The head() and tail() instance methods of pandas Series class return new series objects containing the first and last 'n' elements from a pandas Series. The Python example sorts the series before retrieving the head and tail of a series instance. 2 Nov 2019
- 5 Retrieve the flattened underlying data of a Series The ravel() method of pandas Series class returns the underlying data which is an ndarray. The Python example prints the input Series and the output ndarray. 2 Nov 2019
- 6 Repeat the elements in a pandas Series The method repeat() makes the elements of a pandas Series instance to repeat as per the frequency specified by the parameter "repeats". The python example uses two kinds of repeat frequency - one for all elements and one at per element basis. 2 Nov 2019
- 7 Replacing pandas series values The methods replace() and mask() replace given values or values satisfying a condition with values specified. 24 Nov 2022