Skip to content
Advertisement

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 make a mapping over it. But I have a problem with this regex,

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 output row has

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 without the function calling itself over and

Predicting in parallel using concurrent.futures of tensorflow.keras models

I am trying to implement some parallel jobs using concurrent.futures. Each worker requires a copy of a TensorFlow model and some data. I implemented it in the following way (MWE) simple_model() creates the model. clone_model clones a TensorFlow model. work represents an MWE of possible work. worker assigns the work in parallel. This is not working, it just stuck and

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’s a method to

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 read in files into python. I couldn’t find any useful

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 Python libraries. For ex, “import nltk”

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 correct the correlation line chart. I don’t know

Advertisement