How to use 'pandas select all columns except' in Python

Every line of 'pandas select all columns except' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
1006def select_dtypes(self, include=None, exclude=None):
1007 start = time.time()
1008 init = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
1009
1010 _select_dtypes = self._data.select_dtypes(include, exclude)
1011
1012 finish = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
1013 self._last_operation_dict['time'] = time.time() - start
1014 self._last_operation_dict['name'] = 'select_dtypes'
1015 self._last_operation_dict['mem_usage'] = finish - init
1016 return _select_dtypes
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

42def extractCols(df, colnames):
43 extracted = df[colnames]
44 df.drop(extracted.columns, axis=1, inplace=True)
45 return extracted

Related snippets