Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import error when trying to import CCA [BUG] #2

Closed
sja14 opened this issue Oct 3, 2022 · 2 comments
Closed

Import error when trying to import CCA [BUG] #2

sja14 opened this issue Oct 3, 2022 · 2 comments
Assignees

Comments

@sja14
Copy link

sja14 commented Oct 3, 2022

Hi,
I'm using your awesome library in a financial engineering course.
In Colab, when I run the line:

from frds.measures import cca

I get the following import error related to the statistics library dependency:

ImportError                               Traceback (most recent call last)
[<ipython-input-23-f3b52035cd61>](https://localhost:8080/#) in <module>
----> 1 from frds.measures import cca
      2 

2 frames
[/usr/local/lib/python3.7/dist-packages/frds/measures/__init__.py](https://localhost:8080/#) in <module>
      2 
      3 """
----> 4 from .bank import *
      5 from .corporate import *
      6 from .general import *

[/usr/local/lib/python3.7/dist-packages/frds/measures/bank.py](https://localhost:8080/#) in <module>
      1 from .func_absorption_ratio import absorption_ratio
----> 2 from .func_dip import distress_insurance_premium
      3 from .func_mes import marginal_expected_shortfall
      4 from .func_ses import systemic_expected_shortfall
      5 from .func_cca import cca

[/usr/local/lib/python3.7/dist-packages/frds/measures/func_dip.py](https://localhost:8080/#) in <module>
      1 import math
----> 2 from statistics import NormalDist
      3 import numpy as np
      4 from numpy.random import RandomState
      5 

ImportError: cannot import name 'NormalDist' from 'statistics' (/usr/lib/python3.7/statistics.py)

Your help is much appreciated!
Many thanks!

@mgao6767
Copy link
Owner

mgao6767 commented Oct 3, 2022

Hi @sja14 , NormalDist is introduced in Python3.8. Could you please try to use a higher version and see?

@mgao6767 mgao6767 closed this as completed Oct 4, 2022
@sja14
Copy link
Author

sja14 commented Oct 4, 2022

Upgrading to Python 3.9 on Colab didn't help, but when I used a standard Jupyter notebook on my desktop, everything worked perfectly. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants