Use builtin python function when imported a function of same name

Viewed 24

I have imports as the following:

from pyspark.sql.functions import *

Within these there is a filter function in PySpark. How do I use the python filter function instead. Is the only way to import from PySpark the functions I require?

1 Answers
import pyspark.sql.functions as pyr

then just use pyr.filter() to use pyspark filter and filter() to use python builtin

In general it's better to not use '' from .. import * '' because you're losing informations about which library you're using function from, making your code less clear even thought smaller

Related