0

I have this data in csv file which a column has string value (prediction column). How do I rectify the ValueError so that I can read the file?'enter image description here

Code I attempted:

adata['prediction'].replace('singlet').astype(float)
Caroline
  • 119
  • 8
  • Are you trying to convert a string of chars into a float? – ArchAngelPwn Sep 14 '22 at 03:00
  • Please make this a small, working example. You only need the prediction column and only a few values in it. And btw, are there other values in this column besides "singlet"? If so, are they always the string values of floats. – tdelaney Sep 14 '22 at 03:02
  • 1
    See what `adata['prediction'].replace('singlet')` returns. You'll be better off with `replace("singlet", "0")` – tdelaney Sep 14 '22 at 03:07
  • @tdelaney `adata['prediction'].replace('singlet',0,inplace=True)` `adata['doublet'].replace('singlet',0,inplace=True)` replaced all the 'singlet' into zeros and it didn't give me any error afterwards. Thank you for your help! – Caroline Sep 14 '22 at 06:08

0 Answers0