我試圖用Python擴展運行一些代碼,但是當我嘗試引用的熊貓數據幀列,它說,它無法找到列:U型SQL Python擴展數據框列格式
if "hist_future_flag" not in [x.lower() for x in dfBLData.columns.values.tolist()]:
ProcessSuccessFlag = False
print('dfBLData (Input DataFrame) requires "hist_future_flag" column. Cols in dfBLData are: ')
print(', '.join(dfBLData.columns.values.tolist()))
dfBLData(Input DataFrame)需要「」hist_future_flag「」列。在dfBLData列數是: b'geography 'b'mitm_key',b'target 'b'dow',b'time_key 'b'hist_future_flag' ... [等等]
所以它看起來像是以字節形式出現,但是當我嘗試轉換標題時,python說它們是字符串並且不能被解碼!
下面是相關的U SQL我運行:
@d =
SELECT [geography], [mitm_key], [target], [dow], [time_key],[hist_future_flag]
FROM modeling.dbo.LandingZone
WHERE geography == 5;
@bl =
REDUCE @d
ON geography, mitm_key
PRODUCE
time_key DateTime,
predict float,
hist_future_flag int
USING new Extension.Python.Reducer(pyScript:@myScript);
OUTPUT @bl
TO "/test_reducer.csv"
USING Outputters.Csv(outputHeader: true);