pandas2ri causing Process finished with exit code -1073741819 (0xC0000005)


I am using the python package rpy2, and in my code, I have a pandas Data Frame that I need to convert back to R data.frame. The below code defines the function:

    def prepare_data(self, X_train, y_train):
        concatenates X_train_inner and y_train_inner into one, and make them a data frame
        so we are able to process the data frame by SMOGN, RandUnder, GN, or SMOTER

        # print('preparing data')
        # reshape + rename
        X_train_samp = X_train
        y_train_samp = y_train.reshape(-1, 1)

        print('before concatenate')
        # combine two numpy arrays together into one numpy array
        combined = np.concatenate((X_train_samp, y_train_samp), axis=1)
        print('after concatenate')

        print('before df_combined')
        # transform X_train + y_train into a pandas dataframe
        column_names = self.other + [self.target_variable]
        df_combined = pd.DataFrame(combined, columns=column_names)
        print('after df_combined')

        print('before pandas2ri')
        # convert the combined pandas dataframe to R Data.Frame
        df_combined = pandas2ri.py2ri(df_combined)
        print('after pandas2ri')

        # print('finished preparing data')

        return df_combined

After carefully debugging my program, I realize that the following line:

df_combined = pandas2ri.py2ri(df_combined)

Is causing

Process finished with exit code -1073741819 (0xC0000005)

I have the following:

  • I am running PyCharm 2018.3.3
  • I have python 3.6.7
  • I have pandas 0.24.0
  • I have rpy2 version 2.9.5 (I have downloaded the pre-compiled binary from here)
  • I am on windows (windows 10)

I have been stuck for 4 days with this. What should I do to avoid this ? I have tried to run from the cmd, the code is also breaking but without prompting the message Process finished with exit code -1073741819 (0xC0000005)

asked on Stack Overflow Mar 3, 2020 by Perl • edited Mar 3, 2020 by Perl

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0