The statement
- I'm reading data sets using
Polars.read_csv()
method via a Python file handler:
with gzip.open(os.path.join(getParameters()['rdir'], dataset)) as compressed_file:
df = pl.read_csv(compressed_file, sep = '\t', ignore_errors=True)
- A performance warning keeps popping up:
Polars found a filename. Ensure you pass a path to the file instead of a python file object when possible for best performance.
Possible solutions
- I already tried Python warning suppression, but it seems Polars literally just prints out this statement without any default warning associated.
- Another possibility would be to read using non-handler methods?
Any ideas on how to get rid of this annoying message will be highly appreciated.
os.path.join(getParameters()['rdir'], dataset)
directly toread_csv
? – Shivgzip.open()
method. This I believe is what is raising the warning, since it's not a path. For your second question, I used thewarnings.filterwarnings('ignore')
method. – Tullususgzip.open()
method, otherwise I would have to decompress. – Tullusus