Answers for "regex library with def (apply , lambda)"

0

regex library with def (apply , lambda)

import re # Regular Expression *** regex *** is powerful library for string operation ..
def alphanumeric(x):
  return re.sub('[^A-Za-z0-9]+',' ',(str(x)))# here the sting operation for x in the alphanumeric(x) ** i guessed **
data_1['Model'] = data_1.Model.apply(lambda x: alphanumeric(x))# Here x: for assigning the x value of alphanumeric(x) ** i guessed **
# Each value from 'Model' column gets passed through the alphanumeric function
Posted by: Guest on March-04-2022

Browse Popular Code Answers by Language