Closed knife982000 closed 11 months ago
Hi, thanks for reporting this issue. I will fix it in the next release.
Hi, I cannot reproduce.
int64
is standard Python int
.
With ranx
:
from ranx import Qrels
qrels = Qrels({"1": {"1": 1}, "2": {"2": 1}})
df = qrels.to_dataframe()
df.dtypes["score"] == int
Output:
True
True
With Pandas
, to be sure there is no dtype
conversion:
from pandas import DataFrame
df = DataFrame.from_dict({"q_id": ["1", "2"], "doc_id": ["1", "2"], "score": [1, 1]})
df.dtypes["score"] == int
Output:
True
True
Hi,
I looked more into the problem, and the issue is most likely related to the operating system.
I run the following code on different machines to which I have access.
import pandas as pd
df = pd.DataFrame(data=[[1,2],[2,3]], columns=['a', 'b'])
df.dtypes['a'] == int
and the output changes with the OS. For Linux & MacOS: true For Windows: false
All the installations are based on a conda environment. That might be why you cannot reproduce the bug.
The numpy behaviour of dtype is OS dependent: https://numpy.org/doc/stable/user/basics.creation.html
Sorry to hear that. Yes, I work only with MacOS and Linux machines. Have you tried using WSL?
WSL output is consistent with Linux. So, it is only a windows issue. Anyway, I think that testing for np.int64 instead of should work and it is platform independent.
Thank you for answering. I really like your library.
I changed the data type check as you suggested.
Please update to v0.3.18
.
Thank you.
Describe the bug Bug when reconstructing Qrels from a pandas dataframe. This bug affects also when reading a Qrel from a parquet file as the pandas to Qrels is used internally.
Pandas version: 1.5.2 Ranx: last pip version
To Reproduce Code:
Output:
About the dataframe dtypes It is using int64 instead of int