From 01abb829438a0a727f6e5bf2bbaa823e29c92273 Mon Sep 17 00:00:00 2001 From: Pablo Samuel Castro Date: Wed, 17 Apr 2019 06:11:57 -0400 Subject: [PATCH] Fix remaining instance of ValueError when numerics not cast as float64s, and increase minor version number for new release. PiperOrigin-RevId: 243966695 --- dopamine/colab/utils.py | 11 +++++++++++ setup.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dopamine/colab/utils.py b/dopamine/colab/utils.py index 34868cb6..c501d7ce 100644 --- a/dopamine/colab/utils.py +++ b/dopamine/colab/utils.py @@ -84,6 +84,7 @@ def load_baselines(base_dir, verbose=False): single_agent_data[field_name] = ( single_agent_data[field_name].astype(np.float64)) except ValueError: + # This will catch any non-numerics that cannot be cast to float64. continue if game in experimental_data: experimental_data[game] = experimental_data[game].merge( @@ -285,5 +286,15 @@ def read_experiment(log_path, row_index += 1 + # The dataframe rows are all read as 'objects', which causes a + # ValueError when merging below. We cast the numerics to float64s to + # avoid this. + for field_name in data_frame.keys(): + try: + data_frame[field_name] = data_frame[field_name].astype(np.float64) + except ValueError: + # This will catch any non-numerics that cannot be cast to float64. + continue + # Shed any unused rows. return data_frame.drop(np.arange(row_index, expected_num_rows)) diff --git a/setup.py b/setup.py index 76aa6b9a..15c17504 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ setup( name='dopamine_rl', - version='2.0.2', + version='2.0.3', include_package_data=True, packages=find_packages(exclude=['docs']), # Required package_data={'testdata': ['testdata/*.gin']},