snap-stanford / ogb

Benchmark datasets, data loaders, and evaluators for graph machine learning
https://ogb.stanford.edu
MIT License
1.89k stars 397 forks source link

Pandas 2.0.0 Compatibility with read_csv #420

Closed tempoxylophone closed 1 year ago

tempoxylophone commented 1 year ago

Revision from previous closed PR

Pandas 2.0.0 was released today. A new argument called dtype_backend was added to the read_csv() function that appears to affect the default behavior when reading null values.

When the master.csv files are read with Pandas 2.0.0, the string value "None"now appears to be parsed by default to NaN. This is problematic in places where the meta_info dictionary's properties additional edge files and additional node files are checked to be "None".

see lines 106 and 111 in ogb/linkpropped/dataset.py:

if self.meta_info['additional node files'] == 'None':
    additional_node_files = []
else:
    additional_node_files = self.meta_info['additional node files'].split(',')
The .split(",") function called on these will throw AttributeError: 'float' object has no attribute 'split'.

The easiest way to fix this in the latest version that preserved compatibility with previous versions was to add keep_default_na=False when the csvs are read.

Also very minor fix of inconsistency of the has_edge_attr property of the ogbl-vessel dataset, which was set to False in the make_master_file.py but is True in the latest csv file committed here.

weihua916 commented 1 year ago

Looks good to me, thanks!