Fehler beim Datenimport - Nachbildung bestehenden Codes

Probleme bei der Installation?
Antworten
klori
User
Beiträge: 4
Registriert: Freitag 6. Dezember 2019, 13:56

Hi zusammen,

Ich versuche folgenden Code mit dem dort bereitgestellten Datensatz nachzubilden: http://www.quantatrisk.com/2016/06/05/l ... cy-python/

Allerdings habe ich das Problem, dass wenn ich den code eingebe:

Code: Alles auswählen

df = pd.read_hdf('vanderloo.h5', 'df') 
dass python mir sagt, dass die Datei nicht gefunden wird. Ich bin sehr neu mit Python aber habe da rumgespielt, sodass ich den Code wie folgt angegeben habe:

Code: Alles auswählen

 df = pd.read_hdf('C:/XXXXXXX/vanderloo.h5', 'df')
Dann erhalte ich folgende Fehlermeldung:

Code: Alles auswählen

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    df = pd.read_hdf('C:/XXXX/vanderloo.h5', 'df')
  File "C:\XXXXms\Python\Python38-32\lib\site-packages\pandas\io\pytables.py", line 384, in read_hdf
    store = HDFStore(path_or_buf, mode=mode, **kwargs)
  File "C:\XXXXms\Python\Python38-32\lib\site-packages\pandas\io\pytables.py", line 484, in __init__
    tables = import_optional_dependency("tables")
  File "C:\XXXXms\Python\Python38-32\lib\site-packages\pandas\compat\_optional.py", line 93, in import_optional_dependency
    raise ImportError(message.format(name=name, extra=extra)) from None
[b]ImportError: Missing optional dependency 'tables'.  Use pip or conda to install tables[/b].
Wenn ich allerdings über cmd pip install tables eingebe kriege ich eine üble Fehlermeldung, die ich erstmal aus Übersichtlichkeitsgründen nicht aufführe.

Mir stellt sich nun dahingehend die Frage, wie schaffe ich es Python adäquat auszustatten, damit ich den Code aus dem o.g. Link nachbilden kann?

Ich wäre für eure Hilfe sehr dankbar. Ich habe u.a. überlegt eine csv zu erstellen, allerdings fehlt mir das Verständnis die csv als data.frame zu mappen bzw. geschweige zu improtieren. Ich wäre für jede Hilfe sehr dankbar.

Mit feundlichem Gruß,
der klori
__deets__
User
Beiträge: 14529
Registriert: Mittwoch 14. Oktober 2015, 14:29

Genau die Fehlermeldung waere aber Interessant. Uebersichtlichkeit ist schoen, aber wenig hilfreich hier.
klori
User
Beiträge: 4
Registriert: Freitag 6. Dezember 2019, 13:56

Da hast du auch vollkommen recht, hier die Fehlermeldung:

Code: Alles auswählen

C:\>pip install tables
Collecting tables
  Using cached https://files.pythonhosted.org/packages/ba/75/3bd578ecc89f8375bc24172b5163974620c32975887c5e4d1dadb9d63ef3/tables-3.6.1-2-cp38-cp38-win32.whl
Requirement already satisfied: numpy>=1.9.3 in c:\XXXXX\python38-32\lib\site-packages (from tables) (1.17.4)
Collecting numexpr>=2.6.2
  Using cached https://files.pythonhosted.org/packages/87/91/9e6305ec0f0560bf2c3730ad0b5ff3c8d6b48b442a830ff506bc6c829ac0/numexpr-2.7.0.tar.gz
Installing collected packages: numexpr, tables
    Running setup.py install for numexpr ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\XXXXXX2\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\XXX\pip-install-8wyuilp3\\numexpr\\setup.py'"'"'; __file__='"'"'C:\XXcal\\Temp\\pip-install-8wyuilp3\\numexpr\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\XXX\pip-record-0dfbs0e9\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\XXXX\Temp\pip-install-8wyuilp3\numexpr\
    Complete output (42 lines):
    Warning: Assuming default configuration (numexpr\tests/{setup_tests,setup}.py was not found)running install
    running build
    running config_cc
    unifing config_cc, config, build_clib, build_ext, build commands --compiler options
    running config_fc
    unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
    running build_src
    build_src
    building py_modules sources
    creating build
    creating build\src.win32-3.8
    creating build\src.win32-3.8\numexpr
    building extension "numexpr.interpreter" sources
    build_src: building npy-pkg config files
    running build_py
    creating build\lib.win32-3.8
    creating build\lib.win32-3.8\numexpr
    copying numexpr\cpuinfo.py -> build\lib.win32-3.8\numexpr
    copying numexpr\expressions.py -> build\lib.win32-3.8\numexpr
    copying numexpr\necompiler.py -> build\lib.win32-3.8\numexpr
    copying numexpr\utils.py -> build\lib.win32-3.8\numexpr
    copying numexpr\version.py -> build\lib.win32-3.8\numexpr
    copying numexpr\__init__.py -> build\lib.win32-3.8\numexpr
    copying build\src.win32-3.8\numexpr\__config__.py -> build\lib.win32-3.8\numexpr
    creating build\lib.win32-3.8\numexpr\tests
    copying .\numexpr\tests\test_numexpr.py -> build\lib.win32-3.8\numexpr\tests
    copying .\numexpr\tests\__init__.py -> build\lib.win32-3.8\numexpr\tests
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma
    running build_ext
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
    customize MSVCCompiler using build_ext
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
    Missing compiler_cxx fix for MSVCCompiler
    customize MSVCCompiler using build_ext
    building 'numexpr.interpreter' extension
    compiling C sources
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\XXXXXX\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\XXXX\\Temp\\pip-install-8wyuilp3\\numexpr\\setup.py'"'"'; __file__='"'"'C:\\XXXX\\Temp\\pip-install-8wyuilp3\\numexpr\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\XXXX\pip-record-0dfbs0e9\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

H:\>
Jankie
User
Beiträge: 592
Registriert: Mittwoch 26. September 2018, 14:06

Code: Alles auswählen

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

Glaube das ist Visual Studio 2015, aber du kannst auch irgendwo direkt den eigenständigen Compiler laden.


#edit: https://www.microsoft.com/de-de/downloa ... x?id=48145 das müsste es sein.
klori
User
Beiträge: 4
Registriert: Freitag 6. Dezember 2019, 13:56

Danke für den Tipp! Ich schaffe es erst leider am Wochenende; werde aber definitiv Feedback geben ob es geklappt hat.
klori
User
Beiträge: 4
Registriert: Freitag 6. Dezember 2019, 13:56

Es hat daran gelegen : ) Vielen lieben dank!
Antworten