folllowing this thread: Renaming columns in pandas. I want to use this line:
df.columns = df.columns.str.replace('$','')
The problem is I pivoted the dataframe with df.pivot_table().to_records()
and converted it to records, now my column headers have the following syntax:
"('content2', ':13A::STAT')"
from this I only want to keep: 13A::STAT
, any idea to do so?
Is there any way to avoid this renaming in pivoting the dataframe?
Example dataframe (after pivoting):
occurance ('content2, ':13A::STAT') ('content2', '17B::ACTI')
1 4000 Y
2 NaN 73000
Expected output:
occurance 13A::STAT 17B::ACTI
1 4000 Y
2 NaN 73000