-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Description
Code Sample, a copy-pastable example if possible
import pandas as pd
import numpy as np
table = pd.DataFrame(data=np.random.randn(5,2), index=[4,1,'foo',3,'bar'])
table = table.sort_index()
Problem description
The code above works in python2. However, in python3 a TypeError
is raised:
TypeError: '<' not supported between instances of 'str' and 'int'
The reason for this is described here: mixed-type sequencing cannot be sorted anymore just like this.
Expected Output
No exception when calling sort_index
in python3.
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
pandas: 0.22.0
pytest: None
pip: 10.0.0
setuptools: 39.0.1
Cython: None
numpy: 1.14.2
scipy: 1.0.1
pyarrow: None
xarray: None
IPython: 6.3.1
sphinx: None
patsy: None
dateutil: 2.7.2
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
Metadata
Metadata
Assignees
Labels
No labels