Split CSV

    0

    0

    !pip install sklearn
    import pandas as pd
    from sklearn.model_selection import train_test_split
    
    # Loading csv data
    df = pd.read_csv('EDXRF_HC.csv')
    
    print(df.to_string())
    
    # Splitting csv data
    train, test = train_test_split(df, test_size=0.2, random_state=0)
    
    # Saving train and test files
    train.to_csv('EDXRF_HC_TRAINING.csv', index=False)
    test.to_csv('EDXRF_HC_TESTING.csv', index=False)
    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.