read_stata ignores index parameter · Issue #16342 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@TomAugspurger

Description

@TomAugspurger

Code Sample, a copy-pastable example if possible

import pandas as pd import pandas.util.testing as tm

In [19]: df = tm.makeDataFrame()

In [20]: df.to_stata('foo.stata')

In [21]: pd.read_stata('foo.stata', index='index') Out[21]: index A B C D 0 2wIkgwAbVm 0.310317 -0.753652 -0.509405 -0.309492 1 59guDFHo0l 0.404983 -0.098995 -0.330786 -0.548584 2 5sX3JbPQjk 0.520377 1.379943 2.375164 1.475831 3 UsF3izOnQy -1.413272 0.668192 0.859581 -0.646165 ...

It should be like read_stata('foo.stata').set_index('index')

Side-note, I think elsewhere we use index_col instead of index.

Output of pd.show_versions()

master