Issue with "Ingest Futures bundles using csv files"

I am using ingest function to create a futures bundle, read from csv files that I extracted from my own DB (with simple format with columns like OHLC, expiration_date, symbol,etc) and get this below error

File “D:\dev\Anaconda3\envs\ziprl\Lib\site-packages\zipline\data\bundles\”, line 250, in
File “D:\dev\Anaconda3\envs\ziprl\Lib\site-packages\zipline\data\bundles\”, line 248, in main
File “D:\dev\Anaconda3\envs\ziprl\lib\site-packages\zipline\data\bundles\”, line 445, in ingest
File “D:\dev\Anaconda3\envs\ziprl\Lib\site-packages\zipline\data\bundles\”, line 70, in random_futures_data
File “D:\dev\Anaconda3\envs\ziprl\lib\site-packages\zipline\data\”, line 209, in write
return self._write_internal(it, assets)
File “D:\dev\Anaconda3\envs\ziprl\lib\site-packages\zipline\data\”, line 269, in _write_internal
for asset_id, table in iterator:
File “D:\dev\Anaconda3\envs\ziprl\lib\site-packages\zipline\data\”, line 202, in
((sid, self.to_ctable(df, invalid_data_behavior)) for sid, df in data),
File “D:\dev\Anaconda3\envs\ziprl\lib\site-packages\zipline\data\”, line 363, in to_ctable
# we already have a ctable so do nothing
File “D:\dev\Anaconda3\envs\ziprl\lib\site-packages\zipline\data\”, line 366, in to_ctable
winsorise_uint32(raw_data, invalid_data_behavior, “volume”, *OHLC)
File “D:\dev\Anaconda3\envs\ziprl\lib\site-packages\zipline\data\”, line 77, in winsorise_uint32

File “D:\dev\Anaconda3\envs\ziprl\lib\site-packages\zipline\data\”, line 123, in winsorise_uint32
df[mask] = 0
File “D:\dev\Anaconda3\envs\ziprl\lib\site-packages\pandas\core\”, line 3158, in setitem
self._setitem_frame(key, value)
File “D:\dev\Anaconda3\envs\ziprl\lib\site-packages\pandas\core\”, line 3213, in _setitem_frame
File “D:\dev\Anaconda3\envs\ziprl\lib\site-packages\pandas\core\”, line 5580, in _check_inplace_setting
raise TypeError(
TypeError: Cannot do inplace boolean setting on mixed-types with a non np.nan value

So, it’s clearly a Pandas (btw I’m using 1.2.3) error. I’m thinking of 2 approaches:

  1. Either fixing pandas handling with TypeError. One possible idea is to apply stack/unstack (like this Stackoverflow suggestion, but I’m not quite sure where does this data handling is applied. Plus, I dont want to change pandas behavior as it might impact across the entire env

  2. Another issue is with data itself (which I attach the raw csv here where it throw the error), which it looks clean to me with reasonable OHLC levels (no outliers/etc).


Any ideas how I can fix this? Thanks