Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC/PY3: DataFrame.groupby fails in docs examples #6212

Closed
phaebz opened this issue Jan 31, 2014 · 2 comments · Fixed by #6222
Closed

DOC/PY3: DataFrame.groupby fails in docs examples #6212

phaebz opened this issue Jan 31, 2014 · 2 comments · Fixed by #6222
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Bug
Milestone

Comments

@phaebz
Copy link
Contributor

phaebz commented Jan 31, 2014

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?

@jreback
Copy link
Contributor

jreback commented Jan 31, 2014

ipdb> p uniques
array(['red', 'blue', 1, 2, 'big', 12], dtype=object)
ipdb> p uniques.argsort()
*** TypeError: unorderable types: str() > int()
ipdb> u

I think this is what we call an unexercised path (a bug)

@phaebz
Copy link
Contributor Author

phaebz commented Feb 1, 2014

nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants