import numpy as np
import pandas as pd
使用cu201711为素材
index:
In [323]: cu201711.index
Out[323]:
Int64Index([ 2, 3, 4, 5, 6, 7, 8, 9, 10,
11,
...
9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999, 10000,
10001],
dtype='int64', name='序号', length=12609)
重新编号index:
In [337]:cu201711.index=np.arange(12609)
in[49]: cu201711.values[1]
Out[49]:
array(['time', 'open', 'high', 'low', 'close', 'volume', 'amt', 'chg',
'pct_chg', 'oi', 'BIAS', 'BOLL', 'DMI', 'EXPMA', 'KDJ', 'MA',
'MACD', 'RSI'], dtype=object)
In [339]: cu201711.index
Out[339]:
Int64Index([ 0, 1, 2, 3, 4, 5, 6, 7, 8,
9,
...
12599, 12600, 12601, 12602, 12603, 12604, 12605, 12606, 12607,
12608],
dtype='int64', length=12609)</