# [Solved] Building multi-regression model throws : `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).`

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Building multi-regression model throws : `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).` in python. So Here I am Explain to you all the possible solutions here.

## How Building multi-regression model throws : `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).` Error Occurs?

Today I get the following error Building multi-regression model throws : `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).` in python.

## How To Solve Building multi-regression model throws : `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).` Error ?

1. How To Solve Building multi-regression model throws : `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).` Error ?

To Solve Building multi-regression model throws : `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).` Error If X is your dataframe, try using the `.astype` method to convert to float when running the model:

2. Building multi-regression model throws : `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).`

To Solve Building multi-regression model throws : `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).` Error If X is your dataframe, try using the `.astype` method to convert to float when running the model:

## Solution 1

If X is your dataframe, try using the `.astype` method to convert to float when running the model:

`est = sm.OLS(y, X.astype(float)).fit()`

## Solution 2

if both y(dependent) and X are taken from a data frame then type cast both:-

`est = sm.OLS(y.astype(float), X.astype(float)).fit()`

## 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.