Updated on 2024-10-11 GMT+08:00

FAQs

Question

When I import pandas from a local path, the following alarm is generated:

Procedure

  1. Run the python -m pip install backports.lzma command to install the LZMA module.

  2. Go to the /usr/local/python3/lib/python3.6 directory and edit the lzma.py file. The directory varies depending on hosts. You can run the which command to query the directory used by Python.

    Change

    from _lzma import *
    from _lzma import _encode_filter_properties, _decode_filter_properties

    To

    try:
        from _lzma import *
        from _lzma import _encode_filter_properties, _decode_filter_properties
    except ImportError:
        from backports.lzma import *
        from backports.lzma import _encode_filter_properties, _decode_filter_properties

    Before modification

    After modification

  3. Save the file and exit. Then, import pandas again.