rick Sarkar
rick Sarkar

Reputation: 155

failed to convert string to int in csv file using pandas

I am new in pandas and having a problem Failed to convert String to float while reading csv file using pandas,i have used so far

pd.read_csv('Book2.csv',delimiter=',', index_col=0, skiprows=1,converters={'Open Price (Rs.)':float})

and tried dtype also

both gives an error I am sharing the csv file link: https://drive.google.com/open?id=0B_RSbeIckLLeRlByUlhxUGJ2dWc

Upvotes: 1

Views: 672

Answers (2)

MaxU - stand with Ukraine
MaxU - stand with Ukraine

Reputation: 210812

Check line 1873 in the CSV file - it has a header line (column labels).

Upvotes: 2

Mr_U4913
Mr_U4913

Reputation: 1344

You can do

modelFeatures = [contains all the columns' names you use]
df = df[modelFeatures].astype(float)

Upvotes: 1

Related Questions