How to use 'pandas columns to list' in Python

Every line of 'pandas columns to list' 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
147def __to_list(self, column_or_columns):
148 column_names = column_or_columns
149 if not isinstance(column_names, (list, tuple)):
150 column_names = [column_names]
151 return column_names
39def _drop_col(self, df):
40 '''
41 Drops last column, which was added in the parsing procedure due to a
42 trailing white space for each sample in the text file
43 Arguments:
44 df: pandas dataframe
45 Return:
46 df: original df with last column dropped
47 '''
48 return df.drop(df.columns[-1], axis=1)

Related snippets