Skip to content

Handle category dtype from pandas #2133

Open

Description

@jseabold

Pandas now handles categorical and ordinal variables within the blocks of a DataFrame. Will need to write some code to handle these appropriately. Right now we do get a fairly informative error message though. As an example (Python 3, pandas 0.15.2)

[~/]
[55]: from io import BytesIO

[~/]
[56]: from urllib.request import urlopen

[~/]
[57]: dta = pd.read_stata(BytesIO(urlopen("http://www.stata-press.com/data/r13/fullauto.dta").read()))

rep77 is ordinal and foreign is categorical

Activity

  1. added this to the 0.7 milestone on Dec 15, 2014
  2. jseabold commented on Dec 15, 2014

    @jseabold
    MemberAuthor

    Actually might need some special handling. It doesn't look like it's obvious which are ordered and which aren't. All are assumed to ordered according to their 'codes', formerly 'levels'.

  3. jseabold commented on Jan 9, 2015

    @jseabold
    MemberAuthor
  4. kousu commented on Feb 3, 2015

    @kousu

    In particular, it would be nice if sm.tools.tools.categorical understood these without having to specify which column it is.

  5. modified the milestones: 0.8, 0.7 on Jun 23, 2015
  6. modified the milestones: 0.8, Someday on Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions