0

I have a data frame as shown below

xvalues TTN_163_2.5_-40 TTN_163_2.7_-40 TTN_163_3.6_-40 TTN_164_2.5_-40 TTN_164_2.7_-40 TTN_164_3.6_-40 TTN_165_2.5_-40 TTN_165_2.7_-40 TTN_165_3.6_-40 ... SSN_TK_494_3.6_25   SSN_TK_495_2.5_25   SSN_TK_495_2.7_25   SSN_TK_495_3.6_25   SSN_TK_496_2.5_25   SSN_TK_496_2.7_25   SSN_TK_496_3.6_25   SSN_TK_497_2.5_25   SSN_TK_497_2.7_25   SSN_TK_497_3.6_25
0   20.0000 -61.8108    -60.7467    -61.2690    -61.3187    -60.6145    -62.4299    -60.9081    -60.9708    -62.1521    ... -60.5789    -59.4253    -59.3370    -60.3021    -58.8514    -59.5084    -60.1859    -59.3707    -59.2634    -60.3649
1   23.0279 -58.7591    -58.5892    -60.0966    -59.3629    -58.9252    -60.5079    -59.2122    -58.9782    -59.8201    ... -58.1437    -58.2882    -57.5285    -58.8597    -57.0275    -57.0760    -58.2602    -57.3496    -57.2893    -58.2955
2   26.5142 -58.4440    -58.6020    -58.9999    -58.5177    -58.5390    -60.0002    -59.0422    -57.9660    -58.9891    ... -57.8725    -56.6429    -56.4921    -58.0213    -56.2320    -56.6878    -57.0597    -56.7142    -56.4213    -57.3176
3   30.5284 -58.6903    -57.3153    -59.9111    -58.3504    -57.9701    -58.9579    -58.2964    -57.5424    -58.7915    ... -57.4577    -56.6278    -56.7579    -57.8980    -55.9219    -55.9924    -57.5018    -56.4913    -56.4998    -57.7484
4   35.1502 -58.2258    -56.8677    -58.8472    -58.0947    -57.5878    -58.6074    -58.4582    -57.5944

you can see column name like xvalues,TTN_163_2.5_-40 ,TTN_163_2.7_-40 etc . I need to select the columns whose name contains the below strings.

SFK_619,FFK_TN_631,FFK_571,TTK_538

The codes which I tried given below.It is not working .May I know where I went wrong

df_psrr_funct.loc[:, df_psrr_funct.columns.str.contains("SFK_619" or "FFK_TN_631" or "FFK_571" or "TTK_538")]

2nd one

df_psrr_funct.loc[:, df_psrr_funct.columns.str.contains("SFK_619" or "FFK_TN_631" or "FFK_571" or "TTK_538")]

Both of the above method I tired failed.Any help is appreciated

Hari
  • 333
  • 6
  • 18

0 Answers0