Skip to content

Commit d96e9e1

Browse files
EliEli
authored andcommitted
Fixed temperature conversion with pandas structs
1 parent faabc31 commit d96e9e1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

vtools/functions/unit_conversions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def fahrenheit_to_celsius(x):
318318
same type as `x`
319319
Value(s) in degrees celsius.
320320
"""
321-
cfs= np.asarray(x)
321+
arr = np.asarray(x.values if isinstance(x, (pd.Series, pd.DataFrame)) else x)
322322
out = (arr - 32.0) * (5.0 / 9.0)
323323
return out.item() if np.isscalar(x) else _rewrap_like(x, out)
324324

@@ -335,7 +335,7 @@ def celsius_to_fahrenheit(x):
335335
same type as `x`
336336
Value(s) in farenheit.
337337
"""
338-
arr = np.asarray(x)
338+
arr = np.asarray(x.values if isinstance(x, (pd.Series, pd.DataFrame)) else x)
339339
out = arr * 1.8 + 32.0
340340
return out.item() if np.isscalar(x) else _rewrap_like(x, out)
341341

0 commit comments

Comments
 (0)