Consider the following Dataframe
:
AAA3 ABB3 DAT4 DEE3 ABB4 AAA4 DAA3 EAV3 DAC4 DEE4
01/01/2020 1 1.1 1.5 1.2 1.32 1.2 1.2 1 0.9 0.5
02/01/2020 1 1.1 1.5 1.2 1.32 1.2 1.2 1 0.9 0.5
03/01/2020 1 1.1 1.5 1.2 1.32 1.2 1.2 1 0.9 0.5
04/01/2020 1 1.1 1.5 1.2 1.32 1.2 1.2 1 0.9 0.5
The values are not important, so I am giving all columns the same value.
What I want to do is see if the alphabets characters part of my columns
headers
, has an match among the headers, and if it does, remove the header that has an 4, leaving only the name that has a 3.
For example:
There is an AAA3
, as well as an AAA4
. I want to drop the AAA4
column, leaving only AAA3
.
Note that there is a column named DAC4
, but there isn't a DAC3
. So I want to keep my DAC4
column.
I couldn't solve my problem with the following question : Select by partial string from a pandas DataFrame