Category "python"

Parsing JSON data in a good way [closed]

I have some JSON structured outputs that I would like to parse and get some values from it. But my attempts are not good and viable in deeper

How to make whole line same color in coloredlogs output in Python

I have just started using the coloredlogs package in Python. I am using the version 15.0. I can see that my message changes color depending on its log level (in

Adding drag and drop to a scroll area

I'm trying to create a scroll area that will allow drag and drop in QtPy5. I want to be able to drag one label (label 1) to another label (Label 3) and have the

Flatten XML data as a pandas dataframe

How can I convert this XML file at this address into a pandas dataframe? I have downloaded the XML as a file and called it '058com.xml' and run the code below,

How to create a dummy only if a column has non-zero values for certain dates but zero for other dates

Let's say, I want to identify traders who only traded during bull runs but did not trade (zero values) during downturns or stable periods. Let's say we have two

Returning None after conditional

Trying to return the math.floor of k, which is 2 import numpy as np import math j = 1 def k(j): k = j + 1.2 return k # 2.2 def foo2(): num

Yolov5s on Openvino

I have trained a model using yolov5 and it is working just fine: My ultimate goal is to use a model that I have trained on custom data (to detect the hook and

How to use and update same variable across multiple modules in python independently?

I have 3 files and I want to do something like below [1] conf.py var = 10 # Intialized with 10 (start) [2] file_1.py import conf print(conf.var) # Prints 10

Write data from broadcast variable (databricks) to azure blob

I have a url from where I download the data (which is in JSON format) using Databricks: url="https://tortuga-prod-eu.s3-eu-west-1.amazonaws.com/%2FNinetyDays/am

Is this a valid approach to scale your target in machine learning without leaking information? [closed]

Consider a housing price dataset, where the goal is to predict the sale price. I would like to do this by predicting the "Sale price per Squar

Access array in json file in python

Here is a question from an absolute beginner python developer. Here is the challenge I have :) not being able to access the "status" in this json file: [{

Python/Opencv save multiple images to folder with different names

I am working on image processing, I have a folder with all of the images that needs to be processed, and I want to save all the processed images to another fold

How to prevent Flask-WTF forms from closing modal when submitting invalid input?

I am trying to build a website where you can upload a video (this already works). But when submitting a wrong file format, the Flask-WTF form closes the modal.

Change the start position of cross hair matplotlib cursor example

The snapping cursor when plotted starts at (0,0) making my graph very small. It's doing this Instead of this I think that the code is made so that initially the

How can I insert a data from my table to a combobox read-only?

This is a school activity, here is the complete code. I want to insert data from my table value to Combobox read-only. I also can't clear the text from the two

How do I Concatenate or Combine the dictionary of same data to One

I have the below set of 7 Dictionaries {'empid':785, 'empname':'Ibrahim', 'date(2022,5,1)':'Unmarked'} {'empid':785, 'empname':'Ibrahim', 'date(2022,5,2)':'Unma

Regarding Multiple ROIs in an image using python/opencv

When you select multiple ROIs in an image, how to display them all simultaneously in that image white selecting one by one? How to deselect some selected ROIs i

Problem with Visual Studio Code with Python

Someone can help me to solve this problem, i have this error in Vsc: "The environment variable 'Path' seems to have some paths containing the '"' character. The

Retrieve name of column from its Index in Pandas

I have a pandas dataframe and a numpy array of values of that dataframe. I have the index of a specific column and I already have the row index of an important

pyside/pyqt how to animate an arc simply?

I'm looking for a solution, to animate this arc from 0 - 360°. I'm relative new to Pyside/Pyqt and I don't find such a simple solution (only beginner "unfri