0

I use

Report.iloc[:,6:] = Report.iloc[:,6:].astype(float)

to convert those columns to float. The problem is, that it doesn´t change Report when used in my code file. But when I use it in the Console it works.

Report.iloc[:,6:] = Report.iloc[:,6:].astype(float)
Report.info()
Benni
  • 795
  • 2
  • 7
  • 20
  • 1
    Can you provide a [MCVE]? – IanS Feb 21 '17 at 11:21
  • I can´t reproduce it with a subset of my data. It only fails with this slice (too big to show here) – Benni Feb 21 '17 at 11:33
  • I works now. I use this code now: Report[columns_to_convert] = Report[columns_to_convert].astype(float) – Benni Feb 21 '17 at 11:37
  • Interestingly, I had a [similar question](http://stackoverflow.com/questions/42269935/assign-new-series-to-existing-column-by-column-index) recently. It looks like `iloc` does not work very well with data type changes... – IanS Feb 21 '17 at 12:03

0 Answers0