InsightLab/PyMove

How to carry around a feature column?

Closed this issue · 1 comments

Is your feature request related to a problem? Please describe.
When building the MoveDataFrame, there is no clear way on how to carry around an extra feature column that might be useful. For instance, I am working with bus gps data, but I need to carry the trip_id associated to that bus. However, trip_id is not the traj_id. So, I couldn't figure out how to add this extra info to my MoveDataFrame

Describe the solution you'd like
Maybe something like:

    @staticmethod
    def __new__(
        self,
        data: Union[DataFrame, Dict, List],
        latitude: Optional[Text] = LATITUDE,
        longitude: Optional[Text] = LONGITUDE,
        datetime: Optional[Text] = DATETIME,
        traj_id: Optional[Text] = TRAJ_ID,
        feature_cols: Optional[List[str]] = [],
        type_: Optional[Text] = TYPE_PANDAS,
        n_partitions: Optional[int] = 1,
    ):
        """
        Creates the PyMove dataframe, which must contain latitude, longitude and datetime.

        The dataframe can be a pandas or dask dataframe.

        Parameters
        ----------
        data : DataFrame or PandasMoveDataFrame or dict or list
            Input trajectory data.
        latitude : str, optional
            Represents column name latitude, by default LATITUDE
        longitude : str, optional
            Represents column name longitude, by default LONGITUDE
        datetime : str, optional
            Represents column name datetime, by default DATETIME
        traj_id : str, optional
            Represents column name trajectory id, by default TRAJ_ID
        feature_cols: list, optional
            Extra columns that will be carried by the dataframe, by default []
        type_ : str, optional
            Number of partitions of the dask dataframe, by default TYPE_PANDAS
        n_partitions : Optional[int], optional
            Amount of partitions for dask dataframe, by default 1

        Raises
        ------
        KeyError
            If missing one of lat, lon, datetime columns
        ValueError, ParserError
            If the data types can't be converted.
        """

Feeling very stupid, but I found out how to do that