У меня есть следующий массив numpy
:
numpy_x.shape
(9982, 26)
numpy_x
имеет 9982 записей / наблюдений и 26 столбцов индекса. Это правда правда?
numpy_x[:]
array([[0.00000000e+00, 9.60000000e-01, 1.00000000e+00, ...,
1.20000000e+00, 6.90000000e-01, 1.17000000e+00],
[1.00000000e+00, 9.60000000e-01, 1.00000000e+00, ...,
1.20000000e+00, 7.00000000e-01, 1.17000000e+00],
[2.00000000e+00, 9.60000000e-01, 1.00000000e+00, ...,
1.20000000e+00, 7.00000000e-01, 1.17000000e+00],
...,
[9.97900000e+03, 6.10920994e-01, 7.58135980e-01, ...,
1.08704204e+00, 7.88187535e-01, 1.23021669e+00],
[9.98000000e+03, 6.10920994e-01, 7.58135980e-01, ...,
1.08704204e+00, 7.88187535e-01, 1.23021669e+00],
[9.98100000e+03, 6.10920994e-01, 7.58135980e-01, ...,
1.08704204e+00, 7.88187535e-01, 1.23021669e+00]])
Я хочу сгенерировать фрейм данных с данными, индексом и столбцами numpy_x (индекс и столбцы на самом деле одинаковы?), Затем я продолжаю выполнять следующее:
import pandas as pd
pd.DataFrame(data=numpy_x[:], # I want pass the entire numpy array content
index=numpy_x[1:26],
columns=numpy_x[9982:26])
Но я получаю следующую ошибку:
/.conda/envs/x/lib/python3.6/site-packages/pandas/core/internals.py in construction_error(tot_items, block_shape, axes, e)
4606 raise ValueError("Empty data passed with indices specified.")
4607 raise ValueError("Shape of passed values is {0}, indices imply {1}".format(
-> 4608 passed, implied))
4609
4610
ValueError: Shape of passed values is (26, 9982), indices imply (0, 25)
Как понять, какие параметры передают атрибуты index
и columns
?