Category "python-3.x"

Import local ".py" library in powerbi python scripting

I have written a python library (ak_sql.py) to query my sql server and written another ".py" script (query_sql.py) to invoke this library and return data in dat

If statement calling both functions [duplicate]

I am trying to call a python function inside of an if when you input a certain letter. Even if the letter is not meant to be noticed by the if

Pydantic: Define an attribute of type List with nested lists and multiple sub-models

I have to deal with such a schema: { "method": "Data.get", "params": [ [ { # name this "Fetch" "select_": "Downtime

Stack the same row in each layer of a 3D numpy array

Hi is there a way to efficiently stack the same row in each layer of a 3D numpy array? I have an array like this: a = np.array([[["a111","a112","a113"],

How to calculate coefficients, solutions etc. in quadratic function with limited inputs in Python

I have a problem. I want to calculate everything in the quadratic function. equations for reference: ax^2 + bx + c a(x-p)^2 + q I made 8 possible inputs in tki

PyQT5 - Webview load URL - Unbalanced save/restore

I try to load a page in a webview widget. I got information: QPainter::restore: Unbalanced save/restore QPainter::end: Painter ended with 2 saved states so Web

How to groupby two columns, not considering order of values there?

I have a dataframe: val1 val2 val3 a b 10 a b 2 b a 3 f k 5 f k 2 when i do df.groupby(["val1", "val

Creating an instance in OWLready2 creates a completely new class instead of asigning it to the existing class

I'm trying to create a simple ontology, following the tutorial on the official website. The code runs smoothly and everything seems fine when running this code:

How to overcome value error python model prediction?

I have trained a model and now my task was to test it on unseen images from the internet. Originally the model was trained on CIFAR-10 so for the model I chose

Python - Extract value from list of dictionaries that match a specified key

I have a list of names: names = ['london','paris'] and I have a list of dictionaries: data = [ { "_id": "ebef3cb1-9053-4d1e-b409-b682236445b7",

Can't migrate after makemigrations on django

everyone. I newbie in this field. So, After I finished makemigrations. then I migrate this error code occurs. I try to solve it but still stuck. please guide, I

Cannot create SQLAlchemy engine, getting error "loaded 'mysqldb' is not async"

I'm trying to replace Databases with SQLAlchemy 1.4 async. When I try to make the engine I get the following error: sqlalchemy.exc.InvalidRequestError: The asyn

How to handle extra data error in FastAPI

So I have the following FastAPI code: from fastapi import FastAPI app = FastAPI class Demo(BaseModel): content: str = None @app.post("/demo") async d

Print REGEX using USER DEFINED FUNCTION

I'm trying to print the variables ccb_3, nome, data, taxa and parcela using the function I defined as "ext_ccb", but when I run the code it returns 3 times (bec

Databricks dbfs file read issue

I am trying to open a file that i uploaded to the dbfs location. However, I get error while trying to open the file but I can see the file when I do a ls. Also

Opencv facing an error for tesseract module not found even after installations

Opencv facing an error for tesseract moule not found even after installations pip install tesseract opencv reinstallation also done but it wont work. opencv i

TypeError: 'module' object is not iterable in django 4

TypeError: 'module' object is not iterable in django 4 I am getting the above error, it has persisted long enough than at this point I really need help. I am u

Python Pandas - Lookup a variable column depending on another column's value

I'm trying to use the value of one cell to find the value of a cell in another column. The first cell value ('source') dictates which column to lookup. import p

function which tells whether an array is subsequence of another but 1 of the loop isnt working

def is_subsequence_array(array, sequence): for num in sequence: if array.count(num) != 1 : output = False for i in range(len(sequence) - 1

How to load data from multi-level nesting object

``` when i do the School.objects.filter() query , how to load student object in single query using School.objects.filter() ``` class School(models.Mode