Dataloading using Pandas

I used pandas to load my CSV file. Now how do I convert that dataframe to torch tensors?

1 Like

dataframe -> numpy -> tensor

df = pd.read_csv(csvFilePath)
tmp = df.values
result = torch.from_numpy(tmp)
4 Likes

Thank-you! it worked