def _split_by_users(self, ratings, users_activity):
        """Split the ratings DataFrame into train and test
        Randomly shuffle users and split

        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
            users_activity (pd.DataFrame):
                Number of items each user interacted with

        Returns:
            train_events (pd.Dataframe): pandas DataFrame for training data
            test_events (pd.Dataframe): pandas DataFrame for training data
        """
        idx_perm = np.random.permutation(users_activity.index.size)
        unique_uid = users_activity.index[idx_perm]
        n_users = unique_uid.size

        test_users = unique_uid[: int(n_users * self.test_prop)]
        train_users = unique_uid[int(n_users * self.test_prop) :]

        train_events = ratings.loc[ratings["userId"].isin(train_users)]
        test_events = ratings.loc[ratings["userId"].isin(test_users)]

        return (train_events, test_events)
Split the ratings DataFrame into train and test
        Randomly shuffle users and split

        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
            users_activity (pd.DataFrame):
                Number of items each user interacted with

        Returns:
            train_events (pd.Dataframe): pandas DataFrame for training data
            test_events (pd.Dataframe): pandas DataFrame for training data
        
catalyst/contrib/datasets/movielens.py