79791745

Date: 2025-10-16 03:23:16
Score: 1
Natty:
Report link

i think this thing is happening because the issue is from pivotby() because doesnt return a normal table, it gives a TablePivotby object, so thats why .merge() doesnt work and show you that error message.

in this case you need to convert it to a real table using exec("*") and then you can join it with your OHLC table as normal.

t1 = trade.select("value") \
          .where("tradetime between timestamp(2023.11.06):timestamp(2023.11.11)") \
          .pivotby("tradetime", "securityid,factorname")

# this one convert it to a normal table
t1_table = t1.exec("*")

m = t1_table.join(kline, on=["securityid", "tradetime"], how="left") #joins kline

also just to mentione this isnt really a sql problem, this is about using DolphinDB Python API. why? well. DolphinDB supports SQL like joins and pivots but your code is running python and pivotby() is returning TablePivotby in python, so thats why .merge() fail.

code i shared is actually working right away and its beacuse it uses DolphinDB native functions of join without pulling the data into pandas, just as an additional here is docs.dolphindb.com for reference just in case you need it in the future.

Reasons:
  • Blacklisted phrase (1): doesnt work
  • Blacklisted phrase (0.5): why?
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Jared McCarthy