- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# How to divide a pandas series with scalar using series.div() method?

In the pandas series constructor, the div() or divide() method is used to perform element-wise floating division operation between the two series objects or between a series and a scalar.

The method returns a series with resultant floating division values. We can also do the division operation between series and scalar.

Here we will see some examples for dividing a series with a scalar.

## Example 1

import pandas as pd # create pandas Series series = pd.Series([13,48,6,72,8]) print("Series object:",series) # divide print("combined series:",series.div(2))

## Explanation

In this example, we will divide the Series with a scalar value “2”. Initially, we have created a pandas series object using a list of integer values. After that, we performed the division operation.

## Output

Series object: 0 13 1 48 2 6 3 72 4 8 dtype: int64 combined series: 0 6.5 1 24.0 2 3.0 3 36.0 4 4.0 dtype: float64

In the above block, we can see both initial and resultant series objects. The element-wise division operation is performed between series elements and scaler value “2”.

## Example 2

import pandas as pd # create pandas Series series = pd.Series([13,48,6,72,8]) print("Series object:",series) # divide print("combined series:",series.div([1,2,3,4,5]))

## Explanation

Initially, we have created a pandas Series using a python list of integer values. And applied the div() method with a list of scalar values.

## Output

Series object: 0 13 1 48 2 6 3 72 4 8 dtype: int64 combined series: 0 13.0 1 24.0 2 2.0 3 18.0 4 1.6 dtype: float64

The Series.div() method returns a series with floating division values.

- Related Articles
- How to combine a pandas Series with Scalar using Series.combine() method?
- How to apply integer division to the pandas series by a scalar?
- How to remove a specified row From the Pandas Series Using Drop() method?
- How to retrieve the last valid index from a series object using pandas series.last_valid_index() method?
- How to get the final rows of a time series data using pandas series.last() method?
- How can we give the scalar value to the pandas series.divmod() method?
- How does pandas series astype() method work?
- How does pandas series combine() method work?
- How does pandas series combine_first() method work?
- How does pandas series div() method work?
- How to create a series from a list using Pandas?
- How does the pandas Series idxmax() method work?
- How does the pandas Series idxmin() method work?
- How to sort a Pandas Series?
- How to access Pandas Series elements by using indexing?