Converting df into Numpy array



    The above code imports the numpy module, and then creates two arrays, x_train and y_train. x_train contains the training data, while y_train contains the target data.

    import numpy as np
    x_train = df_onehot[['column1', 'column2', 'column3']].values
    y_train = df_onehot['target'].values
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.