[Python] It is not possible to load data from a specific column in the dataset

Discussão em 'Python' iniciado por Stack, Maio 13, 2025.

  1. Stack

    Stack Membro Participativo

    I select columns X and Y to solve the linear regression problem.

    X = df.loc[:, ['Water']]


    y = df.loc[:, ['Superplasticizer']]

    but in the next line of code, he doesn't see it anymore and has to type it in again. At the same time, it gives an error by the column name that I don't quite understand, so I select the column by its number, but python gives an error due to the number of errors.

    x_train = x[:-250], X = df.loc[:,df.columns[4] ] #250 = 25% от всех данных


    x_test = х[-250:]

    ValueError: too many values to unpack (expected 2) - here's a mistake, I don't understand what the error is at all, I've already searched the entire Internet, I haven't found an answer.

    Continue reading...

Compartilhe esta Página