'Input contains NaN, infinity or a value too large for dtype('float64') but i've manually changed Nan values in my database to equal 0
I've been having trouble with my regression formula. my dataset hasn't got any Nan values as I went through my database and replaced any blank cells with the value of 0. I have a feeling its because i have read into 3 different databases? this is my current code:
import seaborn as sns
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error, r2_score
from scipy import stats
covid = pd.read_csv(r'C:\Users\ISAAC\Documents\Business Analytics\Capstone project\complete covid database.csv')
covid.head()
covidEA = pd.read_csv(r'C:\Users\ISAAC\Documents\Business Analytics\Capstone project\europe north america.csv')
covidEA.head()
covidEU = pd.read_csv(r'C:\Users\ISAAC\Documents\Business Analytics\Capstone project\europe.csv')
covidEU.head()
feature = ['total_vaccinations']
label = ['new_deaths']
x = covidEU[feature]
y = covidEU[label]
x_train, x_test, y_train, y_test = train_test_split(x,y)
linreg = LinearRegression()
linreg.fit(x_train, y_train),
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|