When I try to create a new column in my pyspark dataframe with the number of each row. Now I need to select only a range of rows and it just keep bringing the same error
The code i'm using is:
from pyspark.sql.window import Window
w = Window().partitionBy(lit('a')).orderBy(lit('a'))
df1 = my_dataframe.withColumn("row_num", row_number().over(w))
display(df1.filter(col("row_num").between(1,40)))
And the error is:
TypeError: 'int' object is not callable
The snippet I'm using can be found here in this stackoverflow post.
Thanks!