Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error **Python TypeError: cannot convert the series to class ‘int’ when trying to do math on dataframe** **in python**. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

Table of Contents

## HowPython TypeError: cannot convert the series to class ‘int’ when trying to do math on dataframe Error Occurs?

Today I get the following error **Python TypeError: cannot convert the series to when trying to do math on dataframe** **in python**.

## How To Solve Python TypeError: cannot convert the series to class ‘int’ when trying to do math on dataframe Error ?

**How To Solve Python TypeError: cannot convert the series to class 'int' when trying to do math on dataframe Error ?**To Solve Python TypeError: cannot convert the series to when trying to do math on dataframe Error Seems your initial data contains strings and not numbers. It would probably be best to ensure that the data is already of the required type up front.

**Python TypeError: cannot convert the series to class 'int' when trying to do math on dataframe**To Solve Python TypeError: cannot convert the series to when trying to do math on dataframe Error Seems your initial data contains strings and not numbers. It would probably be best to ensure that the data is already of the required type up front.

## Solution 1

What if you do this (as was suggested earlier):

new_time = dfs['XYF']['TimeUS'].astype(float) new_time_F = new_time / 1000000

## Solution 2

Seems your initial data contains strings and not numbers. It would probably be best to ensure that the data is already of the required type up front.

However, you can convert strings to numbers like this:

pd.Series(['123', '42']).astype(float)

instead of `float(series)`

**Summery**

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

**Also, Read**