[Python] How to merge tarin and test dataset after splitting but each row back to its original...

Discussão em 'Python' iniciado por Stack, Novembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    import pandas as pd
    import numpy as np
    from sklearn.datasets import fetch_openml
    # Load diabetes dataset
    diabetes = fetch_openml("diabetes", version=1, as_frame=True)
    diabetes_df = diabetes.data
    diabetes_df['target'] = diabetes.target # Adding target column

    from sklearn.model_selection import train_test_split
    # Split the data
    train, test = train_test_split(diabetes_df, test_size=0.3, random_state=42)


    I want to combine both Train and Test dataset but same as original data index.

    Note:But after make some miss I split the dataset to trian and test dataset and imputed train and test dataset separately

    Continue reading...

Compartilhe esta Página