Commit dc302bf7 authored by iregon's avatar iregon
Browse files

Changed replacement method back to str method, but managing all nan before

parent 01a1dd51
......@@ -39,7 +39,9 @@ class df_converters():
offset = offset if offset else self.numeric_offset
# First do the appropriate managing of white spaces, to the right, they mean 0!
data = data.replace(r'^\s*$', np.nan, regex=True)
data = data.replace(' ', '0')
# str method fails if all nan
if data.count() > 0:
data = data.str.replace(' ', '0')
# Convert to numeric, then scale (?!) and give it's actual int type
data = pd.to_numeric(data,errors = 'coerce') # astype fails on strings, to_numeric manages errors....!
data = offset + data * scale
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment