2017-04-13 33 views
2

我試圖用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); 

回答

1

我們已經在2017年4月13日部署了新的比特,我們進行了更改以不將字符串轉換爲字節。請重新安裝擴展程序並再次嘗試。

0

原來使用比選擇的「價值」的方法以外的任何時候,列名錶示是「b'columnname'」 。它基本上是以字節爲單位的列名稱的字符串表示形式。

0

謝謝。我將這個線索轉發給了產品團隊,看看它是否已經修復,如果沒有,他們會添加修補程序。