I'm consuming an API and some column names are too big for mysql database.
How to ignore field in dataframe?
I was trying this:
import pandas as pd
import numpy as np
lst =['Java', 'Python', 'C', 'C++','JavaScript', 'Swift', 'Go']
df = pd.DataFrame(lst)
limit = 7
for column in df.columns:
if (pd.to_numeric(df[column].str.len())) > limit:
df -= df[column]
print (df)
result:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
My preference is to delete the column that is longer than my database supports.
But I tried slice to change the name and it didn't work either.
I appreciate any help