i seems cant find the right answer after spending long time searching for the correct problem here
so, i got
sites = df_sim1['site_id'].unique()
['XXX092' 'XXX093']
i'm using it to create 2 dataframes from 1 big dataframe
for site in sites:
exec(f"{site} = df_sim1[df_sim1['site_id']==site].reset_index(drop=True)")
f"{site} = {site}.drop(['site_id'], axis=1)"
and got 2 dataframes XXX092, XXX093
so I need to remove the column 'site_id', i'm thinking about looping it again
for site in sites:
for column in site.columns:
if "site_id" in column:
site.drop(column, axis = 1, inplace=True)
i got error "AttributeError: 'str' object has no attribute 'columns'"
if i'm defining the sites as
sites = [XXX092, XXX093]
i got my desired result which column 'site_id' removed from all my dataframe, any clue where do I go wrong?