When running: the following is printed: Warning: no model found for ‘en’ Only loading the ‘en’ tokenizer. /site-packages/spacy/data is empty with the exception of the init file. all filepaths are only pointing to my single installation of python. Any help appreciated on resolving this.…
jupyter notebook import error: no module named ‘matplotlib’
I’m an ubuntu 16.4 user and I installed anaconda3 and using both python2 and python3 kernels. >>>jupyter kernelspec list Available kernels: python2 /home/peterkim/.local/share/jupyter/kernels/python2 python3 /home/peterkim/anaconda3/share/jupyter/kernels/python3 and.. the problem was that I don…
Remove ‘seconds’ and ‘minutes’ from a Pandas dataframe column
Given a dataframe like: I would like to remove the ‘minutes’ and ‘seconds’ information. The following (mostly stolen from: How to remove the ‘seconds’ of Pandas dataframe index?) works okay, but it feels strange to convert a datetime to a string then back to a datetime. Is …
check if two numeric values have same sign in numpy (+/-)
currently i am using numpy.logical_or with numpy.logical_and to check if elements of two arrays have same sign. Was wondering if there is already a ufunc or a more effective method that will achieve this. My current solutions is here edit// output Answer One approach with elementwise product and then check fo…
How to automatically annotate maximum value in pyplot
I’m trying to figure out how I can automatically annotate the maximum value in a figure window. I know you can do this by manually entering in x,y coordinates to annotate whatever point you want using the .annotate() method, but I want the annotation to be automatic, or to find the maximum point by itse…
How to output above the last printed line?
Is there a way in python to print something in the command line above the last line printed? Or, similarly to what I want to achieve, remain the last line intact, that is, not overwrite it. The goal of this is to let the last line in the command line a status/precentage bar. Output example: Next refresh: Next…
How to create our own linux command for python code file
I am new to python. As a part of my project, I am trying to create a linux command for the python file which I have already. For example I have a python file example.py, Here I am trying to make a command like $example –print file.txt . Which means I am giving the input file from the command itself.
How can I read a range(‘A5:B10’) and place these values into a dataframe using openpyxl
Being able to define the ranges in a manner similar to excel, i.e. ‘A5:B10’ is important to what I need so reading the entire sheet to a dataframe isn’t very useful. So what I need to do is read the values from multiple ranges in the Excel sheet to multiple different dataframes. or I have se…
How to drop column according to NAN percentage for dataframe?
For certain columns of df, if 80% of the column is NAN. What’s the simplest code to drop such columns? Answer You can use isnull with mean for threshold and then remove columns by boolean indexing with loc (because remove columns), also need invert condition – so <.8 means remove all columns &g…
Importing matplotlib.pyplot in atom editor
I am using pyzo to run my python scripts. However I felt the need to switch over to the Atom code editor. I can run my python scripts without any problem. At one point I need to use the library matplotlib. In pyzo I would do: But it doesn’t work in Atom Error message: Traceback (most recent call last): …