I am working on a machine learning model using Pyspark. during categorical values handling using regexp_replace I got this error... is it a version problem??

According to the regexp_replace's docs, the last parameter should be a string as well, but you're passing an integer.