Category "python"

I want to asyncronous blink a led during wifi connection micropython board

I have two co-routines. I start led blinking and wifi connection, but after wifi connection is complete i want to stop led blinking function. Led blinking funct

How to install Google Cloud DLP on Mac M1?

I am trying to download Google Cloud DLP on my Mac M1 running macOS Monterey. I am using Python 3.10.4 and pip 22.0.4. I first tried using pip install google-cl

How do I preserve search result in Django pagination

I am new to Django and I have develop form with Country and State field from the Profile Model. If I search for country and a particular state, I want a list of

For loop doesnt execute for all instances - OS Module Python

The code below reads the first 4 letters of a filename, and if a folder with those 4 letters exists then it shifts that file to that folder. Otherwise, it creat

How to filter the elements from nested lists composed of strings

I am trying to access elements from the nested lists. For example, file = [["Name","Age","Medal","Location"],["Jack","31","Gold","China"],["Jim","29","Silver","

How to print data if only matching string found in list?

key_word = ["apple","Apple","Boy","boy"] title1 = "Where the boy" title2 = "The Boy playing cricket" title3 = "hello world" title4 = "I want to buy apple vine

How to color a grayscale image based on a mask?

I have two images: A grayscale image, and a binary mask with the same dimensions. How do I color the image on the mask, while the rest of the image remains gray

Configurable mapping file python

My company is consuming an API that will give us large JSON objects. The API response info may be in dif fields based on query parameters (it's a 3rd party aggr

Query() in TinyDB with multiple files

I use Python + TinyDB, I have 2 json files, and I create 2 TinyDB objects: db = TinyDB(“db.json”) forum = TinyDB(“forum.json”) But how

curve fitting error for optimal parameters while using scipy optimize curvefit in python

I am getting optimization errors while creating map of h3 moments using a self-defined function get_h3 in python for an image file called "image_test". The idea

Python code in visual studio showing "raise Exception( 'Could not find a default OpenFlow controller' )" error

I have just started with the mininet and trying to build networks using python. I have tried to run the code shown in the image and pasted here in the following

How do you connect an arbitrary list of discrete control inputs to a plant?

I have a numpy array of discrete control inputs to provide my plant (one per fixed time_step). How would I hook that array of inputs up to my plant such that th

Keeping quotes from std out for passing to bash

Okay, this is a bit convoluted but I've got a python script that digests a json file and prints a string representation of that file like so for id in pwds.keys

how to make the box in my boxplot bigger?(matplotlib)

I use the matplotlib boxplot and plotted this graph. My question is how can I make the box larger or make the y-axis interval wider?

How to call a function once in a while loop

I have a robotic code, that does the following: camera starts processing and taking images Mounting Holes (hough transform) function detection is activated The

ValueError: shapes (4,166) and (12,12) not aligned: 166 (dim 1) != 12 (dim 0) in Two-Way ANOVA

I have trouble processing data with Two-Way ANOVA this is my data and I wanted to check if there's a difference in preference of Genre by country by using Anov

Append column of arrays in Pandas

I have a dataframe of arrays such as: | A | B | C | |:---- |:------:| -----:| | [0,1,2,3] | [1,2,5,6] | [0,1,4,5] | | [0,0,6,3] | [0,2,0,4] | [3,8,7,1]

how can I solve this circular dependent imports in order to execute many to one insert

I have the following two models in several files: routes/camera/model.py from services.db import db from dataclasses import dataclass from routes.project.models

Django converting isoformat string datetime to tuple and rising error

I'm trying to update two datetimefields for the Skill entity in my db. I'm sure I'm passing an isoformat datetime string. When creating instead of updating ever

spatial regression in Python - read matrix from list

I have a following problem. I am following this example about spatial regression in Python: import numpy import libpysal import spreg import pickle # Read sp