Skip to content

Repeat pattern using python regex

Well, I’m cleaning a dataset, using Pandas. I have a column called “Country”, where different rows could have numbers or other information into parenthesis and I have to remove them, for example: Australia1, Perú (country), 3Costa Rica, etc. To do this, I’m getting the column and I mak…

2D Vectorization of unique values per row with condition

Consider the array and function definition shown: The point of the function is to return the rows of array a that have exactly grpCount groups of elements that each hold exactly grpSize identical elements. For example: As expected, the code outputs out = [[2, 2, 5, 6, 2, 5], [3, 3, 7, 7, 3, 3]]. The 1st outpu…

Scoping and calling Bitcoin price checker

Hi I’m currently making a Bitcoin Price tracker. I have it rigged up so that it will send me an alert when Bitcoins price hits a certain point. I’m still beginner programmer, but it’s working good so far. I’m having trouble figuring out how I should scope and then call my two functions…

How to find the maxValue’s line number in one loop?

here’s the code: Tips how to simplify the code are welcome I would like to find a position of the line that contains the max value(already found that value) I know i can just use another loop to find the placement, but i wonder if there’s a shorter and more efficient way to do it Answer There&#821…

How to import documents into python?

I have several unstructured data stored in sharepoint and I want to import them into python environment to do text classification. However, I am not sure how to achieve this. I found a library called sharepoint (from sharepoint import SharePointSite, basic_auth_opener) but not exactly sure how to use it to re…

ImportError cannot import name Deque with spacy

I’m trying to import spacy to use on VSCode, but I am getting an error: “Exception has occurred: ImportError cannot import name Deque.” I did pip install -U spacy in my virtual environment. Wondering how to solve the error so that I can use spacy? This import error goes away if I try other P…

make correlation plot on time series data in python

I want to see a correlation on a rolling week basis in time series data. The reason because I want to see how rolling correlation moves each year. To do so, I tried to use pandas.corr(), pandas.rolling_corr() built-in function for getting rolling correlation and tried to make line plot, but I couldn’t c…