Pandas: Add `_get_numeric_data()` to the public API?

Created on 26 Dec 2013  路  6Comments  路  Source: pandas-dev/pandas

In a tool that I'm building that utilizes Pandas data frames, I'm adding a simple data validation layer to only accept numeric columns of a given data frame. I found a Stack Overflow question from a bit over a year ago pointing out the private _get_numeric_data() method in the DataFrame class. Would it be possible to make this method part of the public API?

(And my apologies if this request has been made before; I did a few searches through the issues and didn't find anything.)

All 6 comments

Could you write a function that filters based on the dtypes property?
Shouldn't be too difficult and lets you customize what you want to get.

I think this would be a pretty limited use case, so I'd prefer not to
expand the public API for this.

feel free to submit a function to say the cookbook for dtype filtering

I find myself implementing this functionality over and over again. FWIW, I think having a public API for get_dtype would be super useful where it's more general than just a filter. Ie., get numeric types, get object types, get categorical types. Or even get numeric, object, date, or categorical column names.

!

How have I never noticed this? Cross-linking. This is more or less addressed in #7434.

Was this page helpful?
0 / 5 - 0 ratings