Skip to content
Advertisement

pandas.read_csv() returns strings from columns instead numbers

I am trying to find linear regression plot for the data provided

JavaScript

when I try to plot it

JavaScript

the plot was completely empty and when I printed the type of X

JavaScript

it shows the type is string.. Where am I standing wrong???

Advertisement

Answer

No need to make new DataFrames for X and y. Try astype(float) if you want them as numeric:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement