最佳答案
How do I train a simple neural network with PyTorch on a pandas dataframe df
?
The column df["Target"]
is the target (e.g. labels) of the network. This doesn't work:
import pandas as pd
import torch.utils.data as data_utils
target = pd.DataFrame(df['Target'])
train = data_utils.TensorDataset(df, target)
train_loader = data_utils.DataLoader(train, batch_size=10, shuffle=True)