Quantcast
Browsing all 14069 articles
Browse latest View live

What is wrong with the following code for sending a verification email?

the output gets to "STAGE 1" but after that it comes up with a bunch of errors. The tutorial im using is here: https://www.youtube.com/watch?v=g_j6ILT-X0k def send_email(): print("send_email function")...

View Article


Can Python logging write the name of the current function?

Is there a way to configure logging to automatically prefix the logged information with the current function name (=the function currently in execution when logger.info is called)?import...

View Article


Image may be NSFW.
Clik here to view.

Error generating token in FastAPI with Bcrypt

I am watching a tutorial on FastAPI, where it switched the database from SQLite to PostgreSQL, before generating a token. It was working before but now it has an error, shown belowreturn...

View Article

Use the first positiv number of a row if a certrain condition in another...

I want to have the first non-negativ number in a new column, based on three columns (valueA, valueB, valueC) if a condition in columnA is valid. The condition is that columnA!=None. And an example...

View Article

How to catch DateParseError in pandas?

I am running a script that uses pd.to_datetime() on inputs that are sometime not able to be parsed.For example if I try to run pd.to_datetime('yesterday') it results to an errorDateParseError: Unknown...

View Article


Why can not I see logs in Azure Function app?

I am working on Azure Function App (Python on Linux), but I am unable to view the logs.When I go to web portal to the Function App - tab Log Stream, the page never loads. There is just a spinning...

View Article

Why does `scipy.optimize.minimize` always return the initial value?

I have a complete working code that uses scipy.optimize.minimize but always returns the initial value as the optimized scalar parameter. Here is the complete code:import sysimport randomimport numpy as...

View Article

I am plotting a graph by reading a csv file. I wanted to convert ticks of...

import osimport csvimport matplotlib.pyplot as plt # Plotting for each CSV file for i in range(len(x_values)): plt.plot([x_values[i], x_values[i]], [y_values[i], 0], marker='', linestyle='-',...

View Article


Summing up a list of numbers with a twist

I want to sum up a list of numbers excluding 6 and 9 and every number in between them. The twist is the list has multiple 6s and 9s.*Edit : numbers should only be excluded if it is between 6 and...

View Article


Can not patch a function in unittest of python with mock

I have this function in my code:from stem.process import launch_torfrom stem.util import termfrom . import checksdef _launch(torrc: str, tmpdir: str, verbose: bool) -> None: try: tractor_process =...

View Article

Conda environment not showing up in VS Code

I installed miniconda on Windows 10 and created an environment (I followed this guide: https://www.notion.so/shashankkalanithi/Setting-Up-Conda-Environment-ba83f7f019ea44b9af37588eed419eb9). However...

View Article

Running excel file in colab

Getting an error message when trying to load an Excel sheet in Google colab. The Excel contains 5000 plus rows.I tried: data=pd.read_excel('/content/data_ml.xlsx')Error obtained:...

View Article

Does resume_from_checkpoint also make the trainer not go through the same data?

Would resume_from_checkpoint={path_to_checkpoint} just make the trainer go through the data again, regardless of whether it should be a new epoch? Or would it start from the point in the data at which...

View Article


OpenAI API error: "The api_key client option must be set either by passing...

I'm a little confuse about using openai in python, and need a little help to make this code work Tryed several solutions found on stackovfw, none of them are working. My goal is to make a python code...

View Article

Cartopy Select any country with a mouse click

I need your help with this. I want to left click on a country, ex Italy. Print the name Italy and color Italy on the map. Should be usable with any country. Here is my code:import matplotlib.pyplot as...

View Article


Image may be NSFW.
Clik here to view.

Wrong detection of Circle when using cv2.minEnclosingCircle

I am trying to detect and draw a circle in somes grayscale images using OpenCV. The Canny Edge Detection works perfectly, but for some reason the circle derived the points in the Canny fit horribly. I...

View Article

Telethon offset id stops before reaching 1

Why does requesting from some large chats or channels suddenly stop, before eaching offset id 1? Example:[!] Progress for '1234567890': Offset ID is: 1 | Total Messages: 1150[!] Progress for...

View Article


Add/fill pandas column based on range in rows from another dataframe

Working with pandas, I have df1 indexed by time samples:data = '''\time flags input 8228835.0 53153.0 32768.08228837.0 53153.0 32768.08228839.0 53153.0 32768.08228841.0 53153.0 32768.08228843.0 61345.0...

View Article

Serverless framework with serverless-python-requirements does not work

I opened this thread on githubI'm trying to use libraries in my python backend.I have it deployed with serverless framework. This is my configuration:serverless.yml: plugins: - serverless-offline -...

View Article

Can I make conditional statements with HTML tags in python?

I am doing a web scraping project. My data is from Wikipedia, List of largest companies in the United States by revenue. When I extract the data (the first table), I can't get the revenue growth column...

View Article
Browsing all 14069 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>