-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
from typing import Annotated, Any
import pandas as pd
from impunity import impunity
from pitot.isa import pressure
@impunity
def foo(df: pd.DataFrame) -> dict[str, Any]:
altitude: Annotated[pd.Series, "ft"] = df.altitude
d = {"hPa": pressure(altitude) / 100}
print(d) # BUG: d is empty!!
return d
@impunity
def foo2(df: pd.DataFrame) -> dict[str, Any]:
altitude: Annotated[Any, "ft"] = df.altitude
hPa: Annotated[Any, "hPa"] = pressure(altitude)
d = {"hPa": (("points",), hPa)}
print(d) # BUG: d is empty!!
return d
@impunity
def foo3(df: pd.DataFrame, in_hPa: bool = True) -> dict[str, Any]:
altitude: Annotated[Any, "ft"] = df.altitude
hPa: Annotated[Any, "hPa"] = pressure(altitude)
if in_hPa:
d = {"hPa": (("points",), hPa)}
else:
d = {"Pa": (("points",), pressure(altitude))}
# TypeError: units must be of type str, Unit or UnitsContainer; not <class 'list'>.
return d
df = pd.DataFrame({"altitude": [1000, 2000, 3000]})
print(df)
d = foo(df)
print(d)
d = foo2(df)
print(d)
d = foo3(df)
print(d)Metadata
Metadata
Assignees
Labels
No labels