Category "python"

Why is my discord bot posting old memes? | Discord.py

I'm making a discord meme bot and its working but I have a small problem with it. It keeps sending the same set of old memes for some reason. How do I fix that?

increment operator ++i does not cause an error in python [duplicate]

Since the increment operator ++ is not supported in python, why doesn't it cause an error when prefixing a variable. Example: i = 3 ++i pr

Is there any difference in the way Python code is executed when run from REPL vs a script in the command line?

I was watching this video, How Do You Read a Python Traceback? and they mention that the traceback you receive will be slightly different depending on whether y

Leetcode Reverse String problem not accepting in-place solution

I am posting two solutions below which I tried in leetcode for the problem no : 344 https://leetcode.com/problems/reverse-string/ Solution 1 class Solution: def

Exception occurs while importing wx on M1 machine

I installed wxPython version 4.1.1 from pip3 and my python version is 3.8.9 on a M1 processor running MacOS Monterey. Importing wx results in the following exce

Without using panda or numpy, how would I separate my data into even columns? Then sum up the last column

I am trying to align the year, model, and price. Then sum up the cost. Saved as 'car.dat' data below without converting to csv or using panda and numpy. 2018,A

Conda can't install packages from requirements.txt available in conda-forge, although package exists in conda-forge

I added conda-forge to the conda channels: $ conda config --show channels channels: - conda-forge - defaults my requirements.txt contains, among others, th

Second graph on the same page with dash and styling specific elements with external stylesheet

I am having trouble fitting two graphs onto one page in dash-plotly. When using code attached below only the top plot is being displayed. Besides that, I do not

argparse subparser exit_on_error

I want to disable exit_on_error for a parser and subparser, to prevent error messages: import argparse if __name__ == '__main__': parser = argparse.Argum

Python Selenium Stealth scrapy not working

I'm trying to use selenium stealth module to scrap an api url in ubuntu server 18.04.4 LTS. I have 2 servers , one for staging and one for production. I deploye

Pandas - Compare each row with one another across dataframe and list the amount of duplicate values

I would like to add a column to an existing dataframe that compares every row in the dataframe against each other and list the amount of duplicate values. (I do

Filter dataframe with multiple conditions including OR

I wrote a little script that loops through constraints to filter a dataframe. Example and follow up explaining the issue are below. constraints = [['stand','=='

How to deploy an existing Python package to JFrog local Artifactory?

I am using local Artifactory, no remote. For in-house Python package deployment, I used python setup.py bdist_wheel upload -r local, it works. I have installed

How to detect the colors nicely using OpenCV python

(It is not the whole code, it's just the main part) It's just a simple project I wanted to do, not school or anything. I want to segment out the red parts nicel

Convert string to int before querying django ORM

I have a model class Entry(models.Model): maca = models.CharField(max_length=100, blank=True, null=True) This field will accept only numbers (cannot set ch

How to calculate Breathing rate from Recorded Audio file (Digital Signal)?

I have one recorded Breathing rate audio file (Digital Signal). So i want to remove noise from the file and calculate Breathing rate value using Python language

Boto3 import not found by SageMaker inference endpoint

I have a PyTorch model deployed on SageMaker, having an inference endpoint. Its configuration is serverless. The structure of the tar.gz model package is as fol

How to insert DEFAULT value with MySQLdb string formatting?

I have run into this a few times now, where I'm trying to insert (or bulk insert) into a MySQL table using VALUES without defining the columns explicitly, but t

how to extract the text from the exec() of function in python

I want to use exec() function to execute a child script inside the main script. but I wanted to do so with other strings in combination but since the exec() com

Is there a way to create a custom dictionary in python

Hello I was wondering if there was an existing version of an idea I had where you can create a custom dictionary like so: MyCustomDict = {'value':'values':'valu