def _format_dataframe(
        df: pd.DataFrame, nautical_units=True
    ) -> pd.DataFrame:
        if "callsign" in df.columns and df.callsign.dtype == object:
            df.callsign = df.callsign.str.strip()
        if nautical_units:
            df.altitude = df.altitude / 0.3048
            if "geoaltitude" in df.columns:
                df.geoaltitude = df.geoaltitude / 0.3048
            if "groundspeed" in df.columns:
                df.groundspeed = df.groundspeed / 1852 * 3600
            if "vertical_rate" in df.columns:
                df.vertical_rate = df.vertical_rate / 0.3048 * 60
        df.timestamp = pd.to_datetime(df.timestamp * 1e9).dt.tz_localize("utc")
        if "last_position" in df.columns:
            df = df.query("last_position == last_position").assign(
                last_position=pd.to_datetime(
                    df.last_position * 1e9
                ).dt.tz_localize("utc")
            )
        return df.sort_values("timestamp")