Я хочу научиться делать все правильно.
Код: Выделить всё
for col in df_web.columns :
if 'post' in col and col != 'post_title':
df_web.drop(columns=col, inplace = True)
Код: Выделить всё
my_col = [col for col in df_web.columns if not col.startswith("post") or col == 'post_title']
df_web = df_web.loc[:, my_col]
['sku', 'total_sales', 'post_author', 'post_date', 'post_date_gmt',
'product_type', 'post_title', 'post_excerpt', 'post_name',
'post_modified', 'post_modified_gmt', 'guid', 'post_type']
Подробнее здесь: https://stackoverflow.com/questions/793 ... olumn-name
Мобильная версия