After converting 'xlsx' file to 'nc' format, an error keeps popping up while saving.

Asked 1 years ago, Updated 1 years ago, 391 views

ValueError: could not convert string to float: Error like 'One'

The storage code is test_4d_array.to_netcdf('test (2010-2022).nc').

python

2023-02-09 06:51

1 Answers

I'll show you a reproduction of the error message.

>>> float("1")
1.0
>>> float("2.33")
2.33
>>> s = 1
>>> float(s)
1.0
>>> s = 3.3
>>> float(s)
3.3
>>> s = "One"
>>> float(s)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: could not convert string to float: 'One'
>>>


2023-02-09 07:09

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.