py-why / dowhy

DoWhy is a Python library for causal inference that supports explicit modeling and testing of causal assumptions. DoWhy is based on a unified language for causal inference, combining causal graphical models and potential outcomes frameworks.
https://www.pywhy.org/dowhy
MIT License
7.04k stars 926 forks source link

Fix issues with pandas 2.0 in GCM module #1023

Closed bloebp closed 1 year ago

bloebp commented 1 year ago

Addresses https://github.com/py-why/dowhy/issues/1020

The issue was that pandas versions prior to 2.0 correctly inferred the data type from an input like np.array([[2.0]], dtype=object) (even though the dtype is object). In contrast, pandas 2.0 does not make this inference. However, the two-dimensional value was unintentional in the first place. It should be np.array([2.0], dtype=object), which is then correctly handled across all versions.