title: How do I convert a Pandas dataframe to a PyTorch tensor?
body: <p>How do I train a simple neural network with PyTorch on a pandas dataframe <code>df</code>?</p>
  <p>The column <code>df[&quot;Target&quot;]</code> is the target (e.g. labels) of the network. This doesn't work:</p>
  <pre><code>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)
  </code></pre>