In pandas, you can convert a pandas Series or DataFrame object to a NumPy ndarray by using the .values
attribute.
To tensor a pandas Series, you can use the following code:
main.py122 chars8 lines
To tensor a pandas DataFrame, you can use the following code:
main.py179 chars9 lines
The resulting tensor
variable will be a NumPy ndarray that you can use for further analysis or processing.
gistlibby LogSnag