Closed
Description
This is a follow-up on #5530 and the general Python 3 compat for docs issue. It is the first episode of my journey into the unknown Python-3-compat-for-doc-examples-land.
While some errors should be rather easy to fix (e.g. xrange
) I just stumbled upon this one (doc/source/comparison_with_r.rst
line 54) which fails under Python 3:
import pandas as pd
import numpy as np
options.display.max_rows=15
from pandas import DataFrame
df = DataFrame({
'v1': [1,3,5,7,8,3,5,np.nan,4,5,7,9],
'v2': [11,33,55,77,88,33,55,np.nan,44,55,77,99],
'by1': ["red", "blue", 1, 2, np.nan, "big", 1, 2, "red", 1, np.nan, 12],
'by2': ["wet", "dry", 99, 95, np.nan, "damp", 95, 99, "red", 99, np.nan,
np.nan]
})
g = df.groupby(['by1','by2'])
g[['v1','v2']].mean()
TypeError: unorderable types: str() > int()
Is the usage wrong here or is it a bug?