You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Example of Pandas bug."""frompandasimportread_csvtry:
fromStringIOimportStringIOexceptImportError:
fromioimportStringIOcsv="""A, B, C1, 2, 3"""defmessage(msg):
"""Print message."""msg_len=len(msg) +2print('-'*msg_len+'\n {}\n'.format(msg) +'-'*msg_len)
message('raw file')
print(csv)
df=read_csv(StringIO(csv), names=['A', 'B', 'C'], skiprows=1, header=None,
usecols=['B', 'C'])
message('expected result after skiping column A')
print(df)
df=read_csv(StringIO(csv), names=['A', 'B', 'C'], skiprows=1, header=None,
usecols=['B', 'C'], index_col='B')
message('not expected result, if use index with column B')
print(df)
Expected Output
Current output:
----------
raw file
----------
A, B, C
1, 2, 3
----------------------------------------
expected result after skiping column A
----------------------------------------
B C
0 2 3
-------------------------------------------------
not expected result, if use index with column B
-------------------------------------------------
B
B
3 2
Expected output:
----------
raw file
----------
A, B, C
1, 2, 3
----------------------------------------
expected result after skiping column A
----------------------------------------
B C
0 2 3
-------------------------------------------------
not expected result, if use index with column B
-------------------------------------------------
C
B
2 3
output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Darwin
OS-release: 15.3.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None
Code Sample, a copy-pastable example if possible
Expected Output
Current output:
Expected output:
output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Darwin
OS-release: 15.3.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None
pandas: 0.17.1
nose: None
pip: 7.1.2
setuptools: 18.3.2
Cython: None
numpy: 1.10.1
scipy: 0.16.1
statsmodels: None
IPython: 4.0.1
sphinx: None
patsy: None
dateutil: 2.4.2
pytz: 2015.7
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.0
openpyxl: 2.3.2
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
Jinja2: 2.8
The text was updated successfully, but these errors were encountered: