how can I get only one data frame or how to overwrite the data frame?
Simply, Overwrite the df1 only
df1= df1[['name','branch']]
or
df2= df1[['name','branch']]
del df1
To delete df1 or df2.
del df1
or
del df2
Based on requirement
df1 =





name
age
branch
subject
date of joining




1
Steve
27
Mechanical
Autocad
01-08-2021


2
Adam
32
Electrical
control sys
14-08-2021


3
Raj
24
Electrical
circuit
20-08-2021


4
Tim
25
Computers
clouding
21-08-2021




df2= [['name','branch']]
print(df2)





name
branch




1
Steve
Mechanical


2
Adam
Electrical


3
Raj
Electrical


4
Tim
Computers




Now I have two data frames,
I need only name and branch columns and remove the remaining columns, all these operations should apply to the original df1.  I don't want separately df2