Category "python"

How to make multiple (more than 2) dependent Dropdowns in python

I have this case. There are 3 dropdown lists A,B,C. List A is independent. List B depends on value select in List A. List C depends on value selected in List B.

Finding the arguments of a cog/command in discord.py

I want to find the arguments of a cog/command to put it in the help command. for cog in client.cogs: if cog.lower() == input[0].lower():

Decision tree regression code, when run shows only 'random_state = 0' and nothing else

I have taken a house price dataset. I have run the following code: import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns

Scikit-learn pipeline: Non-finite test scores error / Inconsistent number of samples

I have a dataframe with two columns of texts and only the POS tags (of the same texts), which I want to use for language classification. I am trying to use both

Can you run the Opacus privacy engine with pytorch SequenceTaggingDataset?

I am trying to adapt a pytorch Named Entity Recognition model to incorporate differential privacy with the Opacus library. My model uses torchtext to build the

Displaying Cooldown In Seconds in On_Message in Discord.py

EDIT: I solved it, I just simply looped the asyncio.sleep and set a variable for the cooldown in seconds. :) I'm new to discord.py and I just started developing

"Hello from the pygame community"

When I executed the following code, instead of an error it said "Hello from the pygame community. https://www.pygame.org/contribute.html". It would be easier fo

Error occurs in pycharm debugger is gone when `print()` is added

The code below fails only in pycharm debugger when the print statement is commented out and a breakpoint is placed on the last line containing a pass. It works

Python modify the path of url without hacky string interpolation [closed]

How to use urllib.parse in python to modify the path of URI? I know I can use substring and index but I am wondering what is the right way to

Error while loading the pytest module in Django project

I am trying to run pytest in a django project with it is showing me error of no module loading. I have created init.py in test folders, but that also not worked

How to validate data received via the Telegram's Web App

I'm trying to validate WebApp data but the result is not what I wanted. Telegram documentation: data_check_string = ... secret_key = HMAC_SHA256(<bot_token&g

minimum number of jumps dynamic programming

I wrote this code to solve a problem called minimum number of jumps which basically asks what are the minimum number of jumps it takes to get from the beginning

Pydantic: Save nested settings

I'm currently trying to automatically save a pydantic.BaseSettings-object to a json-file on change. The model is loaded out of the json-File beforehand. A minim

I installed the Python module, but it still says it's not there's no module

When I make Python code, I keep getting errors. (No module named 'sklearn' and Failed to open file b'C:\\Users\\\xea\xb9\x80\xec\x8a\xb9\xec\xb2\xa0\\AppData\\L

Import error: 'SimpleExperiment' while running BOTORCH example code

I am trying to work with Bayesian Optimisation for my Numerical model run, Optimising its parameters. For this I am using BoTorch. Its example code is given as

remove all rows including words (character) in numpy 2d array python

How can I remore words in my 2d array: from: array([['111', 'ACTG1'], ['131', '124'], ['95', '123'], ['95', '124'], ['95', 'ACTG1'],

Why does column + column concatenation create arrays for some Windows accounts?

When running the below Python code, I get different results depending on the user account/admin privileges that is used. The code is saved as test.py on a Windo

verify if bloomberg-anywhere pdblp session is valid

I want to implement a check if import pdblp is active and if not exit the session. I note from this link (Bloomberg Anywhere + pdblp or xbbg + not logged in) th

Creating db tables with SQLAlchemy and running Celery tasks raises "error with status PGRES_TUPLES_OK and no message from the libpq"

I have an application that runs 2 tasks every minute. Both of them have almost the same code, except for the API endpoint they communicate with (see below). Whe

Python - Conditional 2D Permutation

Question: How might it be possible to calculate the permutations on a 2D array, but such that the sum of the indicies cannot exceed a certain number? E.g: maxsu