<p dir="auto">Hello, I'm not sure if it is an intended behavior or not, and I did not find any mention about this in the documentation or in the github issue tracker. I'm filing it - just in case it was not planned to work this way.</p>
<h4 dir="auto">Problem description</h4>
<p dir="auto">On save to HDF5 file <code class="notranslate">RangeIndex</code> of pandas.DataFrame is converted to <code class="notranslate">Int64Index</code> (which could add quite some to the stored space for the long tables).</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="df = pd.DataFrame(np.random.randn(1000,2))
df.index"><pre class="notranslate"><span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">1000</span>,<span class="pl-c1">2</span>))
<span class="pl-s1">df</span>.<span class="pl-s1">index</span></pre></div>
<p dir="auto">results in <code class="notranslate">RangeIndex(start=0, stop=1000, step=1)</code></p>
<p dir="auto">Then</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="df.to_hdf('tmp.h5', 'df')
df = pd.read_hdf('tmp.h5', 'df')
df.index"><pre class="notranslate"><span class="pl-s1">df</span>.<span class="pl-en">to_hdf</span>(<span class="pl-s">'tmp.h5'</span>, <span class="pl-s">'df'</span>)
<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">read_hdf</span>(<span class="pl-s">'tmp.h5'</span>, <span class="pl-s">'df'</span>)
<span class="pl-s1">df</span>.<span class="pl-s1">index</span></pre></div>
<p dir="auto">results in <code class="notranslate">Int64Index([  0,   1, ..., 999], dtype='int64', length=1000) </code></p>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.6.4.final.0<br>
python-bits: 64<br>
OS: Windows<br>
OS-release: 7<br>
machine: AMD64<br>
processor: Intel64 Family 6 Model 63 Stepping 2, GenuineIntel<br>
byteorder: little<br>
LC_ALL: None<br>
LANG: None<br>
LOCALE: None.None</p>
<p dir="auto">pandas: 0.22.0<br>
pytest: 3.3.2<br>
pip: 9.0.1<br>
setuptools: 38.4.0<br>
Cython: 0.27.3<br>
numpy: 1.14.1<br>
scipy: 1.0.0<br>
pyarrow: None<br>
xarray: None<br>
IPython: 6.2.1<br>
sphinx: 1.6.6<br>
patsy: 0.5.0<br>
dateutil: 2.6.1<br>
pytz: 2018.3<br>
blosc: None<br>
bottleneck: 1.2.1<br>
tables: 3.4.2<br>
numexpr: 2.6.4<br>
feather: None<br>
matplotlib: 2.1.2<br>
openpyxl: 2.4.10<br>
xlrd: 1.1.0<br>
xlwt: 1.3.0<br>
xlsxwriter: 1.0.2<br>
lxml: 4.1.1<br>
bs4: 4.6.0<br>
html5lib: 1.0.1<br>
sqlalchemy: 1.2.1<br>
pymysql: None<br>
psycopg2: None<br>
jinja2: 2.10<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="store.append(df,'df',write_index=True)"><pre class="notranslate"><code class="notranslate">store.append(df,'df',write_index=True)
</code></pre></div>
<p dir="auto">makes sense (<code class="notranslate">index</code> is already taken as its passed thru to determine whether to create an actual on in the table)</p>