Category "python-3.x"

Parsing JSON from POST request using Python and FastAPI

I'm trying to parse a JSON that came from a POST request from user to my API made with FastAPI. I have a nested JSON that can receive multiple values and my pro

Grouping keys and values with Python

I have some data. numeric key and numeric value: [ (468793398, 672), (468793398, 2464), (521683990, 131152) ] I need to group keys and

Why does returned object not get attributes & methods of the class after __new__?

Index objects of diskcahe have the property _cache with Cache object inside it. Cache is created with few arguments from those in Index. Unfortunately, it can t

Regex to find numbers that are not in a phrase

If I have e.g. this string: Beschreibung Menge VK-Preis MwSt% Betrag Schadenbewertunginkl.Restwertermittlung 1 25,00€ 19 25,00€ Rechnungsbetragexcl.Mw

how to use python variables in bash script inside python script

I am trying to use my python variables inside the bash script in the python script as below... import os import submodule URL="http://wmqa.blob.core.windows.net

python requests-html Chromium process leaking

My program cannot run thought the entire loop because a leak crashes it before it gets to the end. I have the following script: from requests_html import HTMLSe

Question - What is the pearson correlation between average dew point and average temperature? my code:

This is my Code * corr_matrix = np.corrcoef(data['Average dewpoint (°F)']data['Average temperature(°F)']) corr = "corr = " + str(round(corr_matrix[1][0]

Why does the y-axis have to be flipped for a cwt analysis in Python to compare to the Matlab cwt function

For the audio file found here, I am using the ssqueezepy library in Python to generate the cwt of the signal. Here is my Python code: import librosa import lib

Write to multiple worksheets

I need to write to multiple sheets with sheets name stored in a list. Below is my code for row_num, obj in enumerate(list,1): sheet = workbook.add_worksheet

program to Read content from 1 file and write string which is started from specific word and end with specific word into another file in python

Write a program to Read content from one file and write a string which is started from a specific word and ends with a different specific word into another file

HTTP Error 401 unauthorized when using python requests package with user-agent header

I am trying to reverse engineer a web app. So far, using the inspect tool on my browser, I have managed to log in the website using python and use multiple part

Django 4: Product.objects.get(id=1) returns an error "DoesNotExist" but I already have 7 products listed

I already have 7 products listed in my DB and I can check them by Product.objects.all() but when I do Product.objects.get(id=1) or pass any id as a parameter it

How can I include external modules when compiling Python code with Cython?

I have an extension that I compile with cython into the related *.pyd or *.so files, which are then imported into my very basic main.py: if __name__ == "__main_

Python Django error "Select a valid choice. That choice is not one of the available choices."

I am relatively new to Django so I am likely doing something obviously wrong but I cant seem to figure out what exactly. I have a model called Report and this h

havie been using js fetch api to post data from the cllient side to the server side in django but its not been posting

haven been trying to fetch data from client side to the server side(url='/update/' using js fetch,been getting the response but the data is not being posted to

Convert text file into dataframe with custom multiple delimiter in python

i'am new to python. I have one txt file. it contains some data like 0: 480x640 2 persons, 1 cat, 1 clock, 1: 480x640 2 persons, 1 chair, Done. date (0.635s) Tue

Python - Division by zero

how can i make something divided by 0 equal base, EX: 5/0 output 5 Sorry I can't explain properly, I'm new to programming

Get rid of single quotes from the substituted string within sed command in Python

I have a text file 1.txt which has following content: module abc I am trying to generate multi-line string that I need to add before module abc line in 1.txt.

how to use Google Cloud Translate API for translating bulk data?

I have a csv file of several thousands of rows in multiple languages and I am thinking of using google cloud translate API to translate foreign language text in

pyautogui, locate on screen doen't work in linux

I am using linux, and it returns none instead of the co-ordinates. import pyautogui as p a=p.locateCenterOnScreen('like.png',confidence=.5) print(a) Did I di