Skip to content

Commit 63d8503

Browse files
committed
try different approach to check version
1 parent e8a7143 commit 63d8503

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lectures/inflation_history.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@ This lecture also requires `pandas >= 2.1.4`
2828

2929
```{code-cell} ipython3
3030
:tags: [hide-output]
31-
import pandas
31+
from importlib.metadata import version
3232
from packaging.version import Version
33-
from importlib import reload
34-
if Version(pandas.__version__) < Version('2.1.4'):
35-
!pip install pandas==2.1.4
36-
reload(pandas)
33+
34+
try:
35+
pandas_version = version("pandas")
36+
except:
37+
pandas_version = '0.0.0'
38+
39+
if Version(pandas_version) < Version('2.1.4'):
40+
!pip install "pandas>=2.1.4"
3741
```
3842

3943
We can then import the Python modules we will use.

0 commit comments

Comments
 (0)