I have this data frame:
df
<code>Node Interface Speed Band_In carrier 1-Jun 10-Jun
Server1 wan1 100 80 ATT 80 30
Server1 wan2 100 60 Sprint 60 30
Server1 wan3 100 96 Verizon 96 15
</code>
<code>Node Interface Speed Band_In carrier 1-Jun 10-Jun
Server1 wan1 100 80 ATT 80 30
Server1 wan2 100 60 Sprint 60 30
Server1 wan3 100 96 Verizon 96 15
</code>
Node Interface Speed Band_In carrier 1-Jun 10-Jun
Server1 wan1 100 80 ATT 80 30
Server1 wan2 100 60 Sprint 60 30
Server1 wan3 100 96 Verizon 96 15
I need to create a new colum name Mx and it needs to be right after the carrier colum and it needs to only pick the max value of columns after carrier. In this case in needs to look at “1-Jun” and “10-Jun” but number of columns could be greater.
resulting df needs to looks like this:
<code>Node Interface Speed Band_In carrier Mx 1-Jun 10-Jun
Server1 wan1 100 80 ATT 80 80 30
Server1 wan2 100 60 Sprint 60 60 30
Server1 wan3 100 96 Verizon 96 96 15
</code>
<code>Node Interface Speed Band_In carrier Mx 1-Jun 10-Jun
Server1 wan1 100 80 ATT 80 80 30
Server1 wan2 100 60 Sprint 60 60 30
Server1 wan3 100 96 Verizon 96 96 15
</code>
Node Interface Speed Band_In carrier Mx 1-Jun 10-Jun
Server1 wan1 100 80 ATT 80 80 30
Server1 wan2 100 60 Sprint 60 60 30
Server1 wan3 100 96 Verizon 96 96 15
I tried this:
<code>df['Mx']=df.max(axis=1)
</code>
<code>df['Mx']=df.max(axis=1)
</code>
df['Mx']=df.max(axis=1)
but this looks at all of the row values?
any ideas?