Skip to content

CLN: refactor of frame.py/panel.py to move common code to generic.py #2915

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

Closed
wants to merge 6 commits into from

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Feb 22, 2013

  • Refactor of frame.py/panel.py to move common code to generic.py
    all axis creation and manipulation code is now common (except for Series)
    • added _setup_axes to create generic NDFrame structures
    • moved methods (some methods moved from series as well)
      • from_axes,_wrap_array,axes,ix,shape,empty,swapaxes,transpose,pop
      • str,bytes,repr
      • iter,keys,contains,len,neg,invert
      • convert_objects,as_blocks,as_matrix,values
      • getstate,setstate (though compat remains in frame/panel)
      • getattr,setattr
      • _indexed_same,reindex_like,reindex,align,where,mask
      • filter (added axis argument to selectively filter on a different axis)
      • reindex : changed a fair amount
      • truncate (moved to become part of PandasObject)
    • API Changes in Panel which make Panel more consistent with DataFrame
      • swapaxes on a Panel with the same axes specified now return a copy
      • support attribute access for setting
      • filter supports same api as original DataFrame filter
  • API change in that reindex called with no arguments will now return a copy of the input object (e.g. df.reindex())

performance is comparable to the existing codebase

Reasoning for this change:

  1. this is in preparation for a change in series to sub-class NDFrame, rather than ndarray directly, with proper support for BlockManager. this will also theoretically allow a way to do integer NaNs, via a mask in the IntBlock
  2. preparation for adding SparseBlocks to BlockManager
  3. future changes/additions in indexing will be more straightforward, e.g. adding an integer like ix can be done, hopefully in one place
  4. future API compatibiliy across objects (e.g. won't have to add methods to both Frame and Panel, and there API can be pretty consistent)

@jreback
Copy link
Contributor Author

jreback commented Mar 9, 2013

@wesm any issues with this?

@ghost
Copy link

ghost commented Mar 9, 2013

sorry to butt in, might it be a good idea to merge this right after 0.11?
it's a big change.

@jreback
Copy link
Contributor Author

jreback commented Mar 9, 2013

that sounds right
pushed till 0.12

jreback added 6 commits March 19, 2013 15:33
         axis creation routines now commonized under _setup_axes
PERF: was missing multi-take opportunity in reindex
      was incorrectly passing to com._count_not_none
      doing an extra copy in certain cases
     moved where,mask,align

TST: make reindex benchmarks longer

CLN: fixed up names for creation in panelnd.py

DOC: minor release notes changes
@jreback
Copy link
Contributor Author

jreback commented Apr 3, 2013

new one at some point

@jreback jreback closed this Apr 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant