1

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

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

You can do

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.