Python Forum

Full Version: groupby and window function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
test.groupBy('symbol','tradingDay',Window('timestamp','5 min')).agg({'open':'first','high':'max','low':'min','close':'last','volume':'sum'}).withColumnRenamed('first(open)',"Open").withColumnRenamed('max(high)',"High").withColumnRenamed('min(low)',"Low").withColumnRenamed('last(close)',"Close").withColumnRenamed('sum(volume)',"Volume").show()

When running the above code getting below error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object() takes no parameters

My actual task is to display max or min data in 5 min window interval

Kindly help
Please post runnable code snippet in Python code tags and full error traceback in error tags. You can find help here. We can't help much with what you have posted thus far.
test.groupBy('symbol','tradingDay',Window('timestamp','5 min')).agg({'open':'first','high':'max','low':'min','close':'last','volume':'sum'}).withColumnRenamed('first(open)',"Open").withColumnRenamed('max(high)',"High").withColumnRenamed('min(low)',"Low").withColumnRenamed('last(close)',"Close").withColumnRenamed('sum(volume)',"Volume").show()
do you REALLY think this is runnabe snippet?