@ptrblck I have created a simple project that reproduces the problem. You can run main.py or the notebook file main.ipynb. A real data file is inside the zip folder as well. All you need is to unzip and run main.
https://drive.google.com/file/d/1-ChQ41zKnpjVbWegUwOMEzzOTlsmSXtk/view?usp=sharing
Please let me know if you have any question