0

The problem I have is that I can not convert one string to a number from a Dataframe column.

The table contains numbers that are in Greek form. That is, the number 21,88 in the Greek form is equal to 21.88 in UK or USA.

For me it does not matter if the decimals will be declared in the Greek form or UK-USA format.

But I would like the python to recognize them as float.

As you can see in image the numbers appear as numbers but when you select the cell t an apostrophe also appears but only in numbers as string …

the excel fille

excel table how can see

zvi
  • 3,677
  • 2
  • 30
  • 48
dimzev
  • 171
  • 9
  • Pandas allows you now to define the `thousands` and `decimal` separators when importing data: [How to efficiently handle European decimal separators using the pandas read\_csv function?](https://stackoverflow.com/questions/11763204/how-to-efficiently-handle-european-decimal-separators-using-the-pandas-read-csv) – Mr. T Jan 09 '22 at 11:34

1 Answers1

2

You can do it this way: pandas.read_csv('your_file.csv', decimal=',')

From the doc:

decimalstr, default ‘.’

Character to recognize as decimal point (e.g. use ‘,’ for European data).

https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html

zvi
  • 3,677
  • 2
  • 30
  • 48