You could use select_dtypes
method of DataFrame. It includes two parameters include and exclude. So isNumeric would look like:
numerics = ['int16', 'int32', 'int64', 'float16', 'float32', 'float64']
newdf = df.select_dtypes(include=numerics)
More Related Contents:
- Change column type in pandas
- Strings in a DataFrame, but dtype is object
- Can pandas automatically read dates from a CSV file?
- How to keep leading zeros in a column when reading CSV with Pandas?
- What is dtype(‘O’), in pandas?
- how to calculation cost time [closed]
- pandas: filter rows of DataFrame with operator chaining
- Pandas groupby: How to get a union of strings
- Reshape wide to long in pandas
- How do I create test and train samples from one dataframe with pandas?
- pandas groupby sort within groups
- Applying function with multiple arguments to create a new pandas column
- pandas groupby, then sort within groups
- Pandas: Cast column to string does not work
- How to query MultiIndex index columns values in pandas
- Add multiple empty columns to pandas DataFrame
- Shift NaNs to the end of their respective rows
- multi index plotting
- No numeric types to aggregate – change in groupby() behaviour?
- Pandas how can ‘replace’ work after ‘loc’?
- Pandas Dataframe: split column into multiple columns, right-align inconsistent cell entries
- Pandas in AWS lambda gives numpy error
- Pandas: Reading Excel with merged cells
- Pandas groupby with categories with redundant nan
- Python numpy: cannot convert datetime64[ns] to datetime64[D] (to use with Numba)
- Slicing multiple ranges of columns in Pandas, by list of names
- Convert pandas DataFrame into list of lists [duplicate]
- Got continuous is not supported error in RandomForestRegressor
- Copy text between parentheses in pandas DataFrame column into another column
- Can I perform dynamic cumsum of rows in pandas?