To convert a numpy array to a pandas dataframe in Python, you can use the pd.DataFrame()
function from the pandas library.
First, import the necessary libraries:
main.py39 chars3 lines
Next, create your numpy array:
main.py32 chars2 lines
Then, convert the numpy array to a pandas dataframe:
main.py23 chars2 lines
Here is the complete code:
main.py95 chars6 lines
Now, you have successfully converted the numpy array (128, 24, 91)
to a pandas DataFrame df
.
gistlibby LogSnag