Category "python"

HTML name/value button attribute not being sent via POST request to server

I am currently using HTMX and Django to process button clicks within a table that adds the selected item to a list. I am trying to use the name/value HTML attri

Exception has occurred: ValueError too many values to unpack (expected 3) when attempting to unpack an array

I'm trying to speed up keypoint detection by pre-generating the keypoints of the objects I want to detect before passing them into FLANN for detection. I'm gett

print the distribution in python using dashes

Here's my code right now. So I would like to visualize a normal distribution graph in python only using these dashes (no import) I am not sure how I should conv

How to get generic types of subclass in Python

I have a generic parent class and a child class that implements the parent with a specific type: T = TypeVar("T") class Parent(ABC, Generic[T]): def get_im

How to fill in row value based on previous and subsequent rows in pandas

I have the following data. There are consecutive runs of True per day, however sometimes there's the odd False for a day followed by True. Due to the nature of

Setup failed..0x80070643-Fatal error during installation

I'm trying to install python.. but it shows an error like.. Setup failed One or more issues caused the setup to fail. Please fix the issues and then retry setup

Preparing input data for LSTM layer with conditions

I have a data frame that looks like the one below: DF.head(20): time var1 var2 prob 12:30 10 12 85 12:31 15

how to do check column values is not clash if all value correspond to same value of other column, if clashed then return that row

s_id PSC pbx 4 pbx 5 pbx 7 pby 8 pbn 8 pby 7 pbn 8 now check PSC of pbx does not clash bt PSC of pbn clashed

How to run Python as X86 with Rosetta2 on ARM MacOS machine

I have a python app with downstream dependencies on dynamic libraries that are available as X86 only. The app runs on a X86 MacOS machine, but on a ARM MacOS ma

**TypeError: 'NoneType' object is not iterable**

I wanted to use an ssh tunnel to access a Mysql database. Unfortunately the architecture of this code doesn't seem to support the format of my query, as the fun

Can I put a Python editor in API documentation

I was working on API documentation and thought it would be really cool if people could demo their code within our API documentation. Setting up an IDE is a real

Mapping team changes over time in Python

I have the following dataframe in Python that lists team lineage for a Formula 1 team in that it identifies when teams change name and what they change to: impo

Can someone help me with a Python command for ctrl + c

I am running a python script on Secure CRT to capture certain data logs. My logs can be stopped by pressing ctrl+c physically on the keyboard. So far I have use

How to solve Matrix Riccati ODE in python

I want to solve the following Matrix Riccati ODE. My Matrix Riccati ODE After searching on the Internet, I found that there is something called continuous-time

Django processing form input name

I have changed the input's name attribute to some custom name, but the view calls form_invalid method. Why my Form isn't saving (validating)? html: <tr>

get list of lists from dict of lists by grouping elements at same index in every key-value pair [duplicate]

I have a dictionary a = {'a':[1,2,3],'b':[4,5,6]} Now, I wish to convert it into a list of lists such that [[1,4],[2,5],[3,6]] i.e. the

Create function that takes in IP or DNS name and pings it

Having trouble writing a python script that will ping an IP or DNS name from the command line. The function needs to return the IP and the time to ping it as a

Having an issue plotting: Columns must be same length as key

I'm new to Python and I'm trying to adjust this code to my data: import random import pandas as pd import numpy as np import matplotlib.pyplot as plt import mat

Set "selected" tag in responsive dropdown and select using Flask and jinja2

I have a flask server which sends a dictionary of options to a dropdown or selection (in form). Here is the Python code: @app.route("/", methods=['GET']) def in

Pandas groupby mean - into a dataframe?

Say my data looks like this: date,name,id,dept,sale1,sale2,sale3,total_sale 1/1/17,John,50,Sales,50.0,60.0,70.0,180.0 1/1/17,Mike,21,Engg,43.0,55.0,2.0,100.0 1