DEV Community

Discussion on: Ten Reasons to Use StaticFrame Instead of Pandas

Collapse
 
flexatone profile image
Christopher Ariza

Many thanks for your comments and question. I agree that the axis argument is confusing: while axis 0 generally means rows and axis 1 generally means columns, there are plenty of places where this association becomes stretched or seems inverted. However, as much as possible, StaticFrame follows NumPy to resolve such potentially arbitrary choices: thus axis 0 and 1 have the same meaning in np.sum() as in sf.Frame.sum(). Given NumPy's long history, following NumPy rather than inventing a new notation seems practical.

Note that in some cases StaticFrame offers more numerous and narrow interfaces that remove the need for an axis argument entirely. For example, there is no axis argument in sf.Frame.drop: instead, __getitem__, loc, and iloc interfaces are exposed on sf.Frame.drop. So a column named "a" can be dropped with sf.Frame.drop['a'], or all columns including and after "a", and all rows including and after "b", can be dropped with sf.Frame.drop.loc['b':, 'a':].

Collapse
 
dlukes profile image
David Lukes

Thank you for the reply! I understand the value of not breaking away from the numpy tradition. Coming up with alternative interfaces which eliminate the need for an axis argument in the first place (when possible) seems like a good way to improve ergonomics while being reasonably conservative about this.

The different semantics of axis in pandas .drop vs. e.g. .sum is my go-to example of this inconsistency, so I did notice when playing around with static-frame that its version of .drop elegantly avoids axis altogether :) Well done!