def _parse(
        self,
        ratings,
        rating_cut=True,
        user_per_item_cut=True,
        item_per_user_cut=True,
        ts_cut=False,
    ):
        """Parses and pre-process the raw data.
        Substract one to shift to zero based indexing
        To-do add timestamp cut

        Args:
            ratings (pd.Dataframe): pandas DataFrame of the following format
                userId	movieId	rating	timestamp
                20	1	924	     3.5	1094785598
                19	1	919	     3.5	1094785621
                86	1	2683	 3.5	1094785650
                61	1	1584	 3.5	1094785656
                23	1	1079	 4.0	1094785665
            rating_cut (bool, optional):
                If true, filter datafreame on the `min_rating` value
            user_per_item_cut (bool, optional):
                If true, filter datafreame on the `min_users_per_item` value
            item_per_user_cut (bool, optional):
                If true, filter datafreame on the `min_items_per_user` value
            ts_cut (bool, optional):
                If true, filter datafreame on the `min_ts` value [TO-DO]

        Returns:
            ratings (pd.Dataframe): filtered `ratings` pandas DataFrame
            users_activity (pd.DataFrame):
                Number of items each user interacted with
            items_activity (pd.DataFrame):
                Number of users interacted with each item.
        """
        if rating_cut:
            ratings = ratings[ratings["rating"] >= self.min_rating].sort_values(
                ["userId", "timestamp"]
            )

        movie_id = "movieId"
        user_cnt_df = (
            ratings[[movie_id]]
            .groupby(movie_id, as_index=False)
            .size()
            .rename(columns={"size": "user_cnt"})
        )
        user_id = "userId"
        item_cnt_df = (
            ratings[[user_id]]
            .groupby(user_id, as_index=False)
            .size()
            .rename(columns={"size": "item_cnt"})
        )

        user_not_filtered = True
        item_not_filtered = True

        while user_not_filtered or item_not_filtered:
            ratings = ratings[
                ratings[movie_id].isin(
                    user_cnt_df.index[user_cnt_df["user_cnt"] >= self.min_users_per_item]
                )
            ]
            ratings = ratings[
                ratings[user_id].isin(
                    item_cnt_df.index[item_cnt_df["item_cnt"] >= self.min_items_per_user]
                )
            ]

            user_cnt_df = (
                ratings[[movie_id]]
                .groupby(movie_id, as_index=False)
                .size()
                .rename(columns={"size": "user_cnt"})
            )
            item_cnt_df = (
                ratings[[user_id]]
                .groupby(user_id, as_index=False)
                .size()
                .rename(columns={"size": "item_cnt"})
            )

            user_not_filtered = (user_cnt_df["user_cnt"] < self.min_users_per_item).any()
            item_not_filtered = (item_cnt_df["item_cnt"] < self.min_items_per_user).any()

        users_activity = (
            ratings[["userId"]]
            .groupby("userId", as_index=False)
            .size()
            .rename(columns={"size": "user_cnt"})
        )
        items_activity = (
            ratings[["movieId"]]
            .groupby("movieId", as_index=False)
            .size()
            .rename(columns={"size": "item_cnt"})
        )
        return ratings, users_activity, items_activity
Parses and pre-process the raw data.
        Substract one to shift to zero based indexing
        To-do add timestamp cut

        Args:
            ratings (pd.Dataframe): pandas DataFrame of the following format
                userId	movieId	rating	timestamp
                20	1	924	     3.5	1094785598
                19	1	919	     3.5	1094785621
                86	1	2683	 3.5	1094785650
                61	1	1584	 3.5	1094785656
                23	1	1079	 4.0	1094785665
            rating_cut (bool, optional):
                If true, filter datafreame on the `min_rating` value
            user_per_item_cut (bool, optional):
                If true, filter datafreame on the `min_users_per_item` value
            item_per_user_cut (bool, optional):
                If true, filter datafreame on the `min_items_per_user` value
            ts_cut (bool, optional):
                If true, filter datafreame on the `min_ts` value [TO-DO]

        Returns:
            ratings (pd.Dataframe): filtered `ratings` pandas DataFrame
            users_activity (pd.DataFrame):
                Number of items each user interacted with
            items_activity (pd.DataFrame):
                Number of users interacted with each item.
        
catalyst/contrib/datasets/movielens.py