Category "python"

Altair: encoding field is specified without a type

Hi my gorgeous friend on the Internet, I have a question about how to plot a Chart in Altair. I have been struggling with this error since yesterday and still h

Unable to pip install pyodbc on mac

I am trying to install pyodbc with pip on macOS(12.3.1), but that didn't work. In error log, Message says "fatal error: 'sql.h' file not found". Some people are

How to return custom JSON response in DRF?

I have created API for News model: models.py class News(models.Model): title = models.CharField(max_length=255) created_at = models.DateTimeField(auto_n

Simulating a square wave with a duty cycle (python)

I was trying to simulate a square wave with a duty cycle but something went wrong and i've been spending the last 3 hours understandig why. Here are the picture

How to write random matrix using loops and without numpy

How can I create two matrixes without numpy as A and B(can also do these operations)? import numpy as np A = np.random.randint(-9, 9, size=(5, 5)) B = np.rando

Firebase SDK for Python: How to initialize App using apiKey?

There is the following code inside a Node.js project: Soon.app = initializeApp({ apiKey: "AIzaSyB4fcG8rtNWAiAtSmxmK3q3JLfMvtNCGP4", projectId: "soonaverse"

Best way to complete asyncio gather if one task is complete

I have the following code where function_1 and function_2 runs independently. However, I want the script to complete once function_2 is complete. import asyncio

Binance API: OSError('Tunnel connection failed: 405 Method Not Allowed')

I am trying to access Binance Vanilla Futures data by using [this code][1] as a framework to better understand how to get the data. However, when I input my API

How to fix 'except ValueError' for python?

I am just starting to learn python and getting an error message that the syntax for calling calculator is wrong. Does anyone have any suggestions? My code: impo

Import geoviews in Anaconda

I am trying to install the geoviews module. I installed it successfully but when I am trying to import it in my code I have this message: No module named 'chann

Reshaping numpy array without changing the data

I'm trying to reshape an array of bitmap images that has a shape of (50,50,90000). How can I modify it so that I can get an array of (90000,50,50)? - I tried ar

Convert a a dictionary into an array in one line

I'm trying to simplify this: urls = [] soup = BeautifulSoup(r.text, "html.parser") items = soup.select('.mydiv a') for item in items: url = item['href']

how to split up a pandas series off of every two words in python

if I have a pandas dataframe with a description of an issue, how can I split each value into two separate words at a time? e.g Subject Number Issue 30493 "This

How to extract multiple texts from span elements using python selenium?

I am trying to extract all the texts in span into list, using the following HTML code from Selenium webdriver method: ['1a', '1b', '1c', '2a', ' ', ' ', '3a', '

extracting the desired link and its order from the links taken with selenium

from selenium import webdriver import time driver = webdriver.Chrome("chromedriver.exe") driver.get('https://www.google.com.tr/search?num=100&q=istanbul%20h

Why can one column of the pandas DataFrame not be filled?

I'm having some problems iteratively filling a pandas DataFrame with two different types of values. As a simple example, please consider the following initializ

Self-Service API Returning NetworkError

I've been trying a number of different example scripts listed on the developer github page here, but they all seem to return errors. from amadeus import Client,

Error 259 on python playsound() unable to sound

I Saw this question here. But my file is already in wav. My code is a timer which plays sound after timer ends using threading. It wasn't working there, then I

Fastest way to chunk and calculate sum, min, max in a 70 GB csv file

I have a 70 GB csv file (data.csv) that has the following structure Timestamp,Price,Volume. 1649289600174,100,100 1649289600176,105,100 1649289600178,109,100 16

How to create Flow object -credentials on Heroku

so I tried a few suggestions that were mentioned in this link -https://stackoverflow.com/questions/47446480/how-to-use-google-api-credentials-json-on-heroku. fi