I am uploading some data frames into snowflake cloud. I had to use the following to transform all field values into string:
data = data.applymap(str)
The only reason I am doing that is that without it, I will get the following error:
TypeError: not all arguments converted during string formatting
The reason for that is there is fields containing numeric values, but not all rows have it, some of them have 'NA' instead. And for data integrity, we cannot replace them with 0
s as in our domain, 0
might seems something, and in our work blank is different to the value of 0
.
At the beginning, I tried to relace NA
a with single quotes ''
, but then, all fields having numbers were transformed into float. So if a value is 123, it will be 123.0
.
How can I replace NA
values in a numeric field into completly blank and not ''
so the field can still be considered as type INT
.
In the image below, I don't want the empty cell to be treated as string, as the other fields will be transformed with the applymap() into floats if they are int: