Category "python"

Why the html custom form is not working django

I have a contact page with a simple form. Here is views.py: def contact_view(request): if request.method == 'GET': form = ContactForm() else: form = Con

BeautifulSoup request is returning an empty list from LinkedIn.com/jobs

I'm new to BeautifulSoup and web scraping so please bare with me. I'm using Beautiful soup to pull all job post cards from LinkedIn with the title "Security Eng

Numpy array multiplies a constant and passed to cosine fucntion shows abnormal values

I want to lower the frequency of a cosine function with 100 times: import numpy as np import math import matplotlib.pyplot as plt x = np.arange(0, 100, 0.1) y

Replacing a value in a column with a value from the same column based upon information

I am looking for a way to do Missing value imputation. There is a table of entries over a given time, with an entry per hour done on days. There is a seperate

Why do my arguments given in the terminal not get parsed by argparse correctly?

I have a question about my code in python. I am supposed to define an input pin and an output pin in the command line. When the input pin gets an input (High or

Encounter an Error Converting Rdd in Dataframe Pyspark

I am trying to turn a rdd into a dataframe. The operation seems to be successful but when I try to count the number of elements in the dataframe I get an error.

Django unable to serve static files from s3 bucket

I created a few models and pushed my project to a development server on an AWS EC2 instance. I used Django storages and followed the docs to configure my settin

Will Nginx run a Python FastAPI endpoint app?

I don't see this answered directly, so it's confusing. None of the tutorials I can find are using Nginx. They use Uvicorn instead for their examples. I have a r

Calculate Mean Absolute Error for each row of a Pandas dataframe

Below is a sample of pandas dataframe that I'm working with. I want to calculate mean absolute error for each row but only considering relevant columns for valu

Matlab System Function and Terminal Runs differently

I have a python code that I want to run in Matlab. It has an `import NumPy statement in it. The code runs without a problem in the terminal. But when I use Matl

How to change the default Pydantic error message using FastAPI?

Is there any way to change the default response from Pydantic so that "msg" is "message"? { "detail": [ { "loc": [ "body

Impossible to click on element with selenium when browser not on mac current space

I'm using selenium in python to control a website. I use Firefox. I want to click on a mat-select element. When Firefox is on one of my Mac used spaces (or desk

how to replace values from a list comprehension? [duplicate]

Im trying to make a list from a string with multiple lines. So every new item in the list will be an entire word, I made it, but I was curious

`pandas.to_latex` - how to make column names bold

When I'm using the pandas.to_latex function to create latex table, the column names are unfortunately not bold. What can I do to make it bold?

how to get around HTTP Error 403: Forbidden error while downloading a video using download link

I'm working on a code in which I access a website using selenium and put a link in a download field then extract the download link from download button and down

Python NSFW detection module nudenet not longer working?

I have been using the python module nudenet for my final degree project. I'm using google colab to run it. It worked correctly and without any problem during th

how to know if a word has repeated letters in python?

I'm working on processing words in python and I want to see if a string has 3 or more occurances of the same letter back to back .Is there a better way to do th

Model Accuracy is High but Val_Accuracy is low

I'm trying to improve my val accuracy as it is very low. I have tried changing the batch_size, the number of images being used for validation and training. Adde

Trying to print the center position of a square

I have tried to use cv2.putText and it appears to show the position based on the the top right of the window and not the actual center of the image. It will pro

Checking if a graph contain a given induced subgraph

I'm trying to detect some minimal patterns with properties in random digraphs. Namely, I have a list called patterns of adjacency matrix of various size. For in