Which PyTorch version are you using?
This dummy code seems to work:
class MyDataset(Dataset):
    def __init__(self, df):
        self.df = df
        
    def __getitem__(self, index):
        x = self.df.iloc[index].values
        x = torch.from_numpy(x).float()
        return x
    
    def __len__(self):
        return len(self.df)

df = pd.DataFrame(np.random.randn(100, 2))
dataset = MyDataset(df)
loader = DataLoader(
    dataset,
    batch_size=2)

next(iter(loader))