TypeError: 'int' object is not subscriptable

I am trying to create a data loader for my dataset. When I run it I am getting the above error.
My code is as:

import torch
import pandas as pd
from torch.utils.data import DataLoader, Dataset
data = pd.read_csv("data.csv")
data = data.to_numpy()
data = data[:,1:].astype('float64')

class MyDataset(Dataset):
    def __init__(self, data, transform = None):
        self.data = data
        self.transform = transform

    def __getitem__(self, index):
        return self.data[index]

    def __len__(self):
        return len(self.data)

data = torch.tensor(data)
test = data
dataset  = MyDataset(data)
train_loader  = DataLoader(dataset)

When I run the below. I am getting the error
" in __getitem__x = self.data[index], TypeError: ‘int’ object is not subscriptable

for epoch in range(1000):
    loss_sum = 0.0
    for i, x in enumerate(train_loader):
        loss = -model.log_prob(x.to(args.device)).mean()
        loss_sum += loss.detach().cpu().item()

Try to print the variable data to see its type (and its shape too): based on the error, it seems to be an integer and not an array.

I tried that and this is its output

<class 'torch.Tensor'>
torch.Size([600, 3000])