Category "python"

Python - Is there a good intermediary format to export mixed data to multiple filetypes?

I have a model which generates output in the form of numpy arrays, text and plots. It currently holds this output as a dictionary. There are requirements for th

Django Quill Editor Display Saved Field

It's probably really simple, but can't figure out how to do that... I have one really simple model: from django.db import models from django_quill.fields import

How to replace values in column when other column is not nan or replace with other?

I am new to Pandas, I am looking for solution where I can replace one column values with other columns. For eg: Replace value of col A with the values in Col E

How to typehint the return value of a function that takes other functions

I have a function that accepts other functions, and would like to type-hint the return value of this "wrapper" function. The function is similar to this below,

How to typehint the return value of a function that takes other functions

I have a function that accepts other functions, and would like to type-hint the return value of this "wrapper" function. The function is similar to this below,

Google Analytics response to Pandas Dataframe in Python

Still a newbie to Python so please be gentle. I'm trying to parse a Google Analytics Reporting API V4 response to a Pandas dataframe in Python, specifically usi

Iterate over lists inside a dictionary

Is there any way to iterate over lists inside a dictionary. A key inside dictionary contains a list which needs to be iterated over separately from the other li

Zipping a list of folders with Python

everyone. I'm really new to Python, so I need some help here. I have a list of folders names inside a .CSV file. All these folders are inside the same path. I n

Python pandas : pivot_table simple string aggregation and sort

I'm trying to achieve something with pandas which is very straightforward to do in Excel PivotTable: From what I've seen, the following code seems logic, but

object detection with YOLO in 2 stream cameras using multithread and opencv

I want to do object detection with YOLO in 2 stream cameras. I use multithread and the result is like in the video. So when 2 camera streams are used, object de

Model accuracy not improving in CNN for image classification

I am using ResNext architecture for classification. the training dataset contains approximately 31000 images distributed among 61 classes. And validation datase

ImportError: "flask_sqlalchemy" could not be resolved

i'm unable to import flask_sqlalchemy even after installing flask-sqlachemy from flask import Flask, render_template from flask_sqlalchemy import SQLAlchemy #

Is it possible to average the output of multiple classification models using pipeline in sklearn?

As an example, suppose there is a random forest and a logistic regression model that accept the same input data, and I want the inference result to be the avera

Confusion in Python Pyomo Components (Parameter and Variable)

I am learning Pyomo Abstract Modeling from a Book. I have an example that has an objective functionEquation is here to minimize the cost of establishing a wareh

AttributeError: 'NoneType' object has no attribute '_with_attr' - Python running tests with pytest

My environment is : Python 3.9.9 Pytest 6.2.5 Brownie 1.17.1 I'm working on the test_fund_me.py from Patrick Collins' Smart Contract tutorial on Youtube; at thi

Normal-gamma distribution in Python

Is there an implementation of the Normal-Gamma distribution for Python? I have looked over the internet, including scipy, and could not find it.

Why do we use __init__ in Python classes?

I am having trouble understanding the Initialization of classes. What's the point of them and how do we know what to include in them? Does writing in classes r

AttributeError: 'int' object has no attribute 'split' pandas

Please, I know there are several issues related to this error of mine, but I'm learning, I don't understand almost anything, so please, if it's not asking too m

`generator` yielded an element of shape (8, 0) where an element of shape (None,) was expected. Traceback (most recent call last):

I was training a network and I decided to add more data for training. my data set is selected from another data but both have (460,620,3) and Uint8 type. but wh

How to check if an element is not displayed in selenium python

How could I check to see if an element is not displayed. I would think it looks something like this. if(element.is_not_displayed): doSomething() else do