Python to Excel basics using xlwings - xlwings

I am new to xlwings and only have a basic knowledge of Python, I use excel for club statistics and graphs and can see how Python will help speed up these tasks. I am however, struggling with the basics of the Python to Excel process. "Instantiate" a workbook for example, Is there a primer for a dunce like me?

If you've got xlwings installed correctly, you should be able to use the xlwings command line client to create the quickstart workbook like so:
xlwings quickstart myproject
Once you've done that, working through the quickstart tutorial should get you started interacting with excel using a python script.

Related

Excel To PDF in Python without win32com

I am trying to convert XLSX file to PDF.
I cannot use win32com as that machine is a server and it has no MS Office in it and there are no plans to do so.
I can't use xlrd as there are charts in the generated xl.
And there is no python3 but python2

No module named 'nltk.lm' in Google colaboratory

I'm trying to import the NLTK language modeling module (nltk.lm) in a Google colaboratory notebook without success. I've tried by installing everything from nltk, still without success.
What mistake or omission could I be making?
Thanks in advance.
.
Google Colab has nltk v3.2.5 installed, but nltk.lm (Language Modeling package) was added in v3.4.
In your Google Colab run:
!pip install -U nltk
In the output you will see it downloads a new version, and uninstalls the old one:
...
Downloading nltk-3.6.5-py3-none-any.whl (1.5 MB)
...
Successfully uninstalled nltk-3.2.5
...
You must restart the runtime in order to use newly installed versions.
Click the Restart runtime button shown in the end of the output.
Now it should work!
You can double check the nltk version using this code:
import nltk
print('The nltk version is {}.'.format(nltk.__version__))
You need v3.4 or later to use nltk.lm.

NLTK Wordnet Download Out of Date

New to Python, tying to get started with NLTK. After a rough time installing Python on my Windows 7 64-bit system, I am now having a rough time downloading Wordnet and other NLTK data packages located here:
http://nltk.org/nltk_data/
Some packages download, some say "Out of Date"
import nltk
nltk.download()
When I use the above to download, the program doesn't let me cancel if I hit the cancel button.
So, I just shut it down and go directly to the link above to try and download it manually. When I try to download Wordnet for example, the download starts in my browser but stops mid-way through download!
This is very frustrating for me as a beginner. Is there an alternative way to download Wordnet for nltk?
I was facing the same issue. The issue in my case was that when the NLTK downloader started it had the server index as
http://nltk.github.com/nltk_data/
This needs to be changed to
http://nltk.org/nltk_data/
You can change this by going into the NLTK Downloader window and the File->Change Server Index.
Regards,
Bonson

Use of Mechanize Library with Python 2.7 and Django

How do I use the mechanize library with Django?
I read online that I could put it in a directory (e.g. /lib/) and include as needed.
The problem is, the the source I had found didn't show how to use it from configuration to initial use. Unfortunately, I also looked high and low elsewhere on google with nothing to find. I also checked a book I have on django without any info..
Can anyone help me out?
I'm on a local install of django with python 2.7.
Thank you
As per comments, the answer is:
pip install mechanize
then just open a python interpreter and import mechanize to confirm.
That should be it, you can start using mechanize in your Django project.

pyspeech not working in python 2.7

I want to make and explore the speech to text using the python. So I searched on the google about the python speech to text api I have found pyspeech at the first and found it much easy to use but even after installing it I got some problems.
1) I have installed pyspeech using command prompt easy_install speech at the c:>python27...scripts but still i am unable to run the python speech API.
2) I have also installed the base PyPI required for the pyspeech running ez_setup.py.
What is the import error you get? pyspeech also needs pywin32.
Is that package installed? Also check if Microsoft speech kit is installed.
If everything is fine, add sys.path.append(site package path) at the top of your code.