PEP8 guidance for column names in pandas dataframe?

Viewed 1608

Is there a standard naming convention that is suggestible for columns in Pandas Dataframes ?

As I looked around, this seems to be the most relevant question or answer on this topic: Pandas DataFrame column naming conventions. I couldn't find anything on PEP8 from quick glances. The solution provided here offers some general advice but no standard leaving it to the developer's prerogative.

import pandas as pd

col_names =  ['MyColumn1', 'Mycolumn2']
my_df  = pd.DataFrame(columns = col_names)

It looks like snake case looks appropriate from my personal perspective, but I want to know what is the standard and if PEP8 has any guidance.

1 Answers

It is really up to you how you name the columns as it is application- or problem specific. At least PEP8 does not care about this and a linter such as flake8 will not complain.

Related