How to use 'extract column from dataframe python' in Python

Every line of 'extract column from dataframe python' 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
42def extractCols(df, colnames):
43 extracted = df[colnames]
44 df.drop(extracted.columns, axis=1, inplace=True)
45 return extracted

Related snippets