Remove Specific characters in dataframe

Solution 1:

Use str.rsplit:

Example 1:

df1['tagname'] = df1['tagname'].str.rsplit('.', 1).str[1]
print(df1)

# Output
   id                 tagname                 datetime
0   1   ACCESS_CLOSE_FAULT_LH  2022-01-20 15:07:36.310
1   2  ACCESS_SENSOR_FAULT_RH  2022-01-20 15:07:36.310
2   3   OUTPUT_POWER_CP_FAULT  2022-01-20 15:07:36.310

Example 2:

df2['tagname'] = df2['tagname'].str.rsplit('.', 1).str[1]
print(df2)

# Output
   id                    tagname                 datetime
0   1              1ST_VACUUM_CH  2021-09-28 17:31:48.191
1   2  SMALL_LEAK_TEST_VACUUM_CH  2021-09-28 17:31:48.193
2   3   VACC_VALUE_CH_FLOAT_R270  2021-09-28 17:31:48.196
3   4                       PRL2  2021-09-28 17:31:48.199
4   5                        DL5  2021-09-28 17:31:48.199