I am workin on a report generator, and I used pip install python-docx and
import docx.
Now I have made a new docx file, edited it but I want to save it in pdf instead of docx file. And the program script will be converted into EXE file.
Please help.
(pip install python-docx)
from docx import Document
doc=Document()
doc.add_heading('Report', 0)
# Now to save file, I know to save in docx,
# But, I want to save in pdf
# I can not finish the program and then manually convert
# As this script will run as an
# **EXE**
doc.save('report.docx')
I tried saving like --> doc.save('report.pdf') But, it did not work.
I fould some thing here: https://medium.com/analytics-vidhya/3-methods-to-convert-docx-files-into-pdf-files-using-python-b03bd6a56f45 I pesonally think the easiest way to do it is the docx2pdf module.
You can use the python package docx2pdf*:
pip install docx2pdf
Then call the convert function:
convert("report.docx", "report.pdf") after saving doc.save('report.docx'). Creating the docx file before converting it is mandatory.
unless you work on a Linux Machine as it requires Microsoft Word to be installed.
Try using the msoffice2pdf library using Microsoft Office or LibreOffice installed in the environment.
https://pypi.org/project/msoffice2pdf/
I often use pickle files to store my dataset. Currently I encounter a trouble. In my local desktop, the python version is python 3.8. However, In the remote server, the python version is python 3.7. I need to work in the remote server. So
I want to know how to read the pickle files created by the python 3.8?
import pandas as pd
df=pd.read_pickle('FUND_AREACLASS.pkl')
The report error is here:
File "C:\ProgramData\Anaconda3_new\lib\site-packages\pandas\io\pickle.py", line 181, in read_pickle
return pickle.load(f)
ValueError: unsupported pickle protocol: 5
Can anybody help me figure it out? Thanks in advance.
I am creating a small CV Screening GUI and would like to test it with my non-tech coworkers. I am looking to send them a GUI.exe file for them to test my ML model. On jupyter notebook, the module is running smoothly using Tkinter. Running the python file works great and the joblib algo works as needed.
When I want to export the GUI file without joblib, also works great however obviously without any ouput as it doesn't have any predict algorithm. Once I load the model using
algo = joblib.load('model.joblib')
And try to export using
pyinstaller.exe –-onedir firstprogram.py
The file exports however runs into an error that says "Could not load joblib file" and the file doesn't open.
I've seen lots of people facing this issue but none seem to have it solved. Any ideas on how to do this? Or maybe a different method than pyinstaller that would incorporate joblib in the .exe file?
I am searching to validate my idea on the decision tree algorithm. That is why I have installed Anaconda3 and try to understand where I should modify (I am a beginner user of python language). I have understood that modification should be on the file _criterion.pyx under site-packages/sklearn/tree. Infact, under this path there is only _criterion.pyd which is already the compiled file of _criterion.pyx.
My question is how to recompile the .pyx file and how to use the configuration file (setup.py) in order to take into account the added modifications when using the DecisionTreeClassifier class.
Can't find any command at http://docs.h5py.org/en/latest/high/file.html to do that.