import pandas as pd
import numpy as np
import torch
转ndarry
:
array = np.array([1, 2, 3, 4, 5, 6, ])
print(torch.from_numpy(array))
转Dataframe
:
dataframe = pd.DataFrame([[1, 2, 3],
[4, 5, 6], ])
print(torch.tensor(data=dataframe.values))