Problem with import pandas

Good Evening

After running this code:

# coding: utf-8
from __future__ import unicode_literals
import plotly.graph_objects as go
import pandas as pd
import os
def inst():
	os.system('pip install plotly')
# Read data from a csv
def surface3d():
	z_data = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv')
	fig = go.Figure(data=[go.Surface(z=z_data.values)])
	fig.update_traces(contours_z=dict(show=True, usecolormap=True, highlightcolor="limegreen", project_z=True))
	fig.update_layout(title='Mt Bruno Elevation', 
	autosize=False, scene_camera_eye=dict(x=1.87, y=0.88, z=-0.64),width=500, height=500,margin=dict(l=65, r=50, b=65, t=90))
	fig.show()

I am getting this error message:

<class 'ImportError'>: No module named '_bz2' (or '_bz2.BZ2Compressor' is unknown)
  File "E:\Program Files\PortableApps\PortableApps\LibreOfficePortable\App\libreoffice\program\pythonscript.py", line 1057, in getScript
    mod = self.provCtx.getModuleByUrl( fileUri )
  File "E:\Program Files\PortableApps\PortableApps\LibreOfficePortable\App\libreoffice\program\pythonscript.py", line 494, in getModuleByUrl
    exec(code, entry.module.__dict__)
  File "E:\Program Files\PortableApps\PortableApps\LibreOfficePortable\Data\settings\user\Scripts\python\LibraryTestplotly\ModuleTestPlotly.py", line 4, in <module>
    import pandas as pd

there seems to be something missing when i import pandas. does anyone have any idea about this? My version of Libreoffice is

Version: 7.3.4.2 (x86) / LibreOffice Community
Build ID: 728fec16bd5f605073805c3c9e7c4212a0120dc5
CPU threads: 8; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL

Look:
https://bugs.documentfoundation.org/show_bug.cgi?id=116412

So problem reported in 2018 and its still around? Wow.

I decided to use matplotlib.

Try following How update Libre Office Python on windows? - Stack Overflow to check if pandas package is installed and install it if it is not.

I will check this in more detail

I have a similar issue pip log show panda 1.5 installed…

1 Like

I guess for me on my workstation, Pandas can not yet be installed. Hopefully this bug will be fixed in the near future.

It should be clear from the answer I linked in Stack Overflow that pip can report packages installed for your system python but that doesn’t mean they are installed for you LibreOffice python.

Now there is an extension Pandas for LibreOffice

1 Like

I will check this