I’m trying to write a function that returns the largest and smallest number in a string. However, not all numbers in the string are 1 digit numbers – some are 2 or 3 digits long. Examples: This exercice originates from codewars.com Answer It’s really easy to do with a list comprehension and …
Tag: python
ffmpeg_extract_subclip function and moviepy string output error
I have been developing this small application to download and cut Youtube videos. It works fine but an error or misformatted message is the issue I have not fixed. When it comes to the cutting process, the function ffmpeg_extract_subclip is used and right after that point, I get the weird error below: Below, …
Dashes with(out) spaces with python’s regex
What I’ve managed to do I’m new to both python and regex. With python’s re.compile, in massive number of text files, I wanted to find all kinds of dashes surrounded by spaces. I used: (Yeah, I know about the regex module on PyPI, but I’m trying to use what I know better) It seems to ha…
Import onnx models to tensorflow2.x?
I created a modified lenet model using tensorflow that looks like this: When I finish training I save the model using tf.keras.models.save_model : Then I transform this model into onnx format using “tf2onnx” module: I want a method that can retrieve the same model into tensorflow2.x. I tried to us…
(Tensorflow) Stuck at Epoch 1 during model.fit()
I’ve been trying to make Tensorflow 2.8.0 work with my Windows GPU (GeForce GTX 1650 Ti), and even though it detects my GPU, any model that I make will be stuck at Epoch 1 indefinitely when I try to use the fit method till the kernel (I’ve tried on jupyter notebook and spyder) hangs and restarts. …
Pandas Dataframe loop to append values to a list for each unique name
I have the following dataframe: I would like to create a list for each unique Name and append the Value values to each list. My expected output is: Any ideas on the most efficient way to do this? thank you! Answer To aggregate as dictionary, you can use: Output:
In Python, how to overlap histogram graphs about data frame inside one panel?
I have a question about overlapping graphs inside one panel in Python. I generated numbers of two groups It works perfectly. However, if the data is the format of data frame, how can I make the same graph? For example, I simulated that I have two data set for different genotypes, cv1, cv2. In each data, grain…
Post successful but response is an error on front end
I am posting data through 127.0.0.8000/post/. My post is of course successful cause I am able to see what I posted in the base URL of 127.0.0.8000 successfully but I get the following response on the Django front end. In VS Code I get the following errors in terminal My Views.Py is the following P.S I am also…
Directory parameter on Windows has trailing backslash replaced with double quote when passed to Python
I am seeing an annoying trailing double quote when passing in a quoted directory in Windows to Python. This is my Python test program, print_args.py: This is what I get when I run it from the command line. Note that the quoted directory is the standard format generated by tab completion in the Windows shell. …
scraping multiple tags at once
I’m trying to scrape the imdb top 250 movies and I want to get all the links of those movies from this page https://www.imdb.com/chart/top/ I tried but I’m only getting the first link only, so my question is how to scale this code to include the whole list of 250 movies? Answer bs.find(‘td&#…