Транзакция завершена, но системы поставщика вернули сообщение INVALID или ERROR в ответ на сообщение POST. Сделка отменена продавцом

Другими решениями являются назначение RangeIndex или range:

df.index = pd.RangeIndex(len(df.index))

df.index = range(len(df.index))

. Это быстрее:

df = pd.DataFrame({'a':[8,7], 'c':[2,4]}, index=[7,8])
df = pd.concat([df]*10000)
print (df.head())

In [298]: %timeit df1 = df.reset_index(drop=True)
The slowest run took 7.26 times longer than the fastest. This could mean that an intermediate result is being cached.
10000 loops, best of 3: 105 µs per loop

In [299]: %timeit df.index = pd.RangeIndex(len(df.index))
The slowest run took 15.05 times longer than the fastest. This could mean that an intermediate result is being cached.
100000 loops, best of 3: 7.84 µs per loop

In [300]: %timeit df.index = range(len(df.index))
The slowest run took 7.10 times longer than the fastest. This could mean that an intermediate result is being cached.
100000 loops, best of 3: 14.2 µs per loop
0
задан M IR soues 5 March 2019 в 16:48
поделиться

0 ответов

Другие вопросы по тегам:

Похожие вопросы: