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

Investigate erroneous int conversion in MultiIndex #285

Closed
wesm opened this issue Oct 24, 2011 · 0 comments
Closed

Investigate erroneous int conversion in MultiIndex #285

wesm opened this issue Oct 24, 2011 · 0 comments
Labels
Milestone

Comments

@wesm
Copy link
Member

wesm commented Oct 24, 2011


>> I was just using this feature and noticed a curious behaviour -- if you have dates in the ISO8601 YYYYMMDD format then importing from csv with a MultiIndex turns them into ints, whereas importing with a regular index parses them to dates.
>>
>> Looking at pandas/io/parsers.py (https://github.com/wesm/pandas/commit/1a5a252d97cb3f691a6bf93412b921b085f1be76#L1L113) it seems that the _maybe_convert_int_mindex() method you added prefers ints over dates -- is this intentional or were you just not expecting any overlap between ints and dates?
>>
>
> Most likely the latter.
>
>> You also no longer call _maybe_convert_int, which was previously being called but is now unused, and instead do the int parsing with a map().
>>
>> Why not just implement _maybe_convert_int_mindex() along the lines of what was originally there, something like this:
>>    for i in range(len(index)):
>>        if parse_dates:
>>            index = _try_parse_dates(index[i], parser=date_parser)
>>        index[i] = _maybe_convert_int(np.array(index[i], dtype=object))
>>
>> I would just do it and submit a patch but I just wanted to check with you as you're more familiar with this code since you wrote it.
@wesm wesm closed this as completed Oct 25, 2011
yarikoptic added a commit to neurodebian/pandas that referenced this issue Nov 2, 2011
* commit 'v0.5.0-7-gcf32be2': (161 commits)
  ENH: add melt function, speed up DataFrame.apply
  DOC: release notes re: GH pandas-dev#304
  BUG: clear Series caches on consolidation, address GH pandas-dev#304
  DOC: fix exceptions in docs
  ENH: cython count_level function, cleanup and tests
  DOC: update release note
  BUG: fix DataFrame.to_csv bug described in GH pandas-dev#290
  RLS: Version 0.5.0
  BLD: another 2to3 fix
  BLD: docstring fixes to suppress 2to3 warnings
  BUG: handle negative indices extending before beginning of Series
  TST: fix test case broken by last change
  BUG: don't be too aggressive with int conversion parsing MultiIndex, GH pandas-dev#285
  BUG: missed one
  BUG: workaround not being able to use cast=True with boolean dtype in Python 2.5
  TST: tuples and strings aren't comparable in python 3
  TST: more 32-bit integer fussiness
  ENH: -> int64 everywhere
  TST: int64 fixes
  TST: 32-bit use 64-bit integer
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant