Pythonで `X_train = X_train.reshape(1, -1)`
を実行したところエラーが起きてしまいまして。初心者で質問も多いですが、指摘よろしくお願いいたします。

```

    import numpy as np
    import pandas as pd
    import matplotlib.pyplot as plt
    import seaborn as sns
    import csv
    
    csvfile = open('BioAsseT practice data5.csv')
    df = pd.read_csv("BioAsseT practice data5.csv")
    X= df.external
    y= df.total
    print(X.shape, y.shape)
    
    from sklearn.model_selection import train_test_split
    
    X_train_val, X_test, y_train_val, y_test=train_test_split(X,y, test_size=0.1, random_state=1)
    X_train, X_val,  y_train, y_val, =train_test_split(X_train_val, y_train_val, test_size=0.5, random_state=1)
    
    from sklearn.tree import DecisionTreeClassifier
    
    dtree=DecisionTreeClassifier(random_state=0)
    
    import numpy as np
    from sklearn.linear_model import LinearRegression
    
    X_train = X_train.reshape(1, -1)
    
```

```

    AttributeError                            Traceback (most recent call last)
    <ipython-input-11-ac8a18039b04> in <module>
    ----> 1 X_train = X_train.reshape(1, -1)
    
    /usr/local/lib/python3.8/dist-packages/pandas/core/generic.py in __getattr__(self, name)
       5485         ):
       5486             return self[name]
    -> 5487         return object.__getattribute__(self, name)
       5488 
       5489     def __setattr__(self, name: str, value) -> None:
    
    AttributeError: 'Series' object has no attribute 'reshape'
    
```
CC BY-SA 4.0
2023-01-23T08:27:06.113
93522
2023-01-23T10:20:02.447
2023-01-23T10:20:02.447
3060
56639
question
python 機械学習 scikit-learn
scikit-learn でエラー:'Series' object has no attribute 'reshape'