Skip to content

Instantly share code, notes, and snippets.

@gidden
Created January 12, 2017 14:39
Show Gist options
  • Save gidden/7d015aceb369c426ff7d5d64d88ec9d6 to your computer and use it in GitHub Desktop.
Save gidden/7d015aceb369c426ff7d5d64d88ec9d6 to your computer and use it in GitHub Desktop.
columns in dataframe with numeric types
def numcols(df):
"""Returns columns in dataframe with numeric types"""
dtypes = df.dtypes
return [i for i in dtypes.index if dtypes.loc[i].name.startswith(('float', 'int'))]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment