1

This very short piece of code does not work with me. It seems to be working for many people since I found it posted in many places.

from sdv.demo import get_available_demos
demos = get_available_demos()
data = load_tabular_demo('student_placements')

The error message I get is:

NameError: name 'load_tabular_demo' is not defined

I Googled it, and found several answers, none of them useful or applicable to my case. I am wondering if it is because I use Python 3.10. I read that SDV won't work on 3.10 (it does on 3.9, 3.8 and so on). Indeed, SDV did not work at all 2 weeks ago on my machine, I could not even install it. Not sure what I did to change my system, it is still Python 3.10, but now at least the first 2 lines of my sample code work and SDV by some magic is installed. The last line data = load_tabular_demo('student_placements') does not work.

  • 1
    Maybe import the `load_tabular_demo` function separately as it may not be included in the `sdv.demo` module by default or use a version of python older than 3.10 – Goran Mar 04 '23 at 09:56
  • Thank you so much ! I did not expect such an easy fix so quickly! By chance, do you know why it works now, after adding "from sdv.demo import load_tabular_demo" ? – Vincent Granville Mar 04 '23 at 10:08
  • 1
    the reason why it works is that the `load_tabular_demo` function was not imported with the initial line `from sdv.demo import get_available_demos` -by importing it separately you have acess to the function and can use it in your code – Goran Mar 04 '23 at 11:00

0 Answers0