To convert a numpy array of shape (128, 24, 91) to a pandas dataframe in Python, you can use the pd.DataFrame()
function from the pandas library. Here's an example:
main.py568 chars21 lines
In this example, we first reshape the numpy array to a 2D shape with dimensions (128*24, 91) using the reshape()
function. Then, we can create a pandas dataframe using pd.DataFrame()
by passing the reshaped array as an argument. Optionally, you can set column names and row names/index for the dataframe using the .columns
and .index
attributes respectively.
Note: The example assumes you have numpy and pandas libraries installed.
gistlibby LogSnag