Today I've been working with five DataFrames that are almost the same, but for different courses. They are named df2b2015, df4b2015, df6b2015, df2m2015.
Every one of those DataFrames has a column named prom_lect2b_rbd for df2b2015, prom_lect4b_rbd for df4b2015, and so on.
I want to append those DataFrames, but because every column has a different name, they don't go together. I'm trying to turn every one of those columns into a prom_lect_rbd column, so I can then append them without problem.
Is there a way I can do that with a for loop and regex.
Else, is there a way I can do it with other means?
Thanks!
PS: I know some things, like I can turn the columns into what I want using:
re.sub('\d(b|m)','', a)
Where a is the columns name. But I can't find a way to mix that with loops and column renaming.
Edit:
DataFrame(s) look like this:
df2b2015:
rbd prom_lect2b_rbd
1 5
2 6
df4b2015:
rbd prom_lect4b_rbd
1 8
2 9
etc.