Pandas DataFrame obtenga el número de columnas
import pandas as pd
df = pd.DataFrame({"pear": [1,2,3], "apple": [2,3,4], "orange": [3,4,5]})
len(df.columns)
3
miletoo
import pandas as pd
df = pd.DataFrame({"pear": [1,2,3], "apple": [2,3,4], "orange": [3,4,5]})
len(df.columns)
3
# PANDAS: get column number from colomn name
dataframe.columns.get_loc("<col_name>")
df.shape[1]