Category "python"

PDF file sent from flask to client is empty when downloaded

I have a flask server that sends a pdf file with the send_file function. When I test this route on postman I can view and download the pdf. However when I try t

snowsql - tls_process_server_certificate

New to snowsql. Installed snowsql and ran the command snowsql -a <account_name> -u <user_name> and that failed with below error: 2022-04-28 18:50:5

Calculating a difference for groups within dataframe

I have a dataframe structured like the example, df, below. This contains 2 variables, time and state. Since these are repeated observations for identity, I want

How to run these Coral AI models inference in a computer rather than on the TPU?

I have the Coral AI usb TPU and I have succesfully run the Getting Started example, deploying the already compiled / trained example model (image classification

Add a column based on a condition that iterates over a list

So I have the following dataframe: Person_x Person_y Apple_x Banana_x Orange_x Apple_y Banana_y Orange_y Tomas Sidd

Error when trying to print string with multiple lines

I'm trying to make a tic tac toe game in Python but whenever I try to print the board, I get a weird error. Here is my code: import os from colorama import Fore

Dask looping over library function call

Goal I would like to parallelize a loop with dask that uses a library function inside the loop. This function, mhw.detect(), calculates some statistics on a sli

PickleType hysteresis: PickleType column sometimes doesn't auto-pickle list, sometimes does

I'm trying to store Python objects (including lists) as blobs in PickleType columns. re PickleType: | PickleType builds upon the Binary type to apply Python's

discord.py 1.7.3 - Send messages to a specific user id ( on_ready )

So I'm having the issue where I send a dm message (message var) to each user id on a list (memberlist var), and when I try to send it, I get an error saying: At

Edit a value in a large csv file which appears multiple times

i have a large tab seperated csv file, about ~10GB, i need to edit all the "direct" words in a column named Tab2 with the value of the column Tab1 in the same r

tf.data pipeline from large numpy arrays for a multiple input, multiple output Keras model and distributed training

This question relates to the optimal setup for a multiple-input multiple-output Keras (Tensorflow) model given corresponding numpy arrays. For example, suppose

Reduce float precission to save memory in Python

I am preparing a code to create an array of 10^5 rows and 10^4 columns with Python. Each element of the array is a float (1.504096744947185, e.g.), which takes

Having a loop issue

I am running the following code for pi value to calculate the first value which yields 3.14. I used manual values for range which works, but I want the values t

Convert list of strings of delimited values to list of lists of floats [closed]

I have this array of strings of comma-separated numbers: data = ['1,14.23,1.71,2.43,15.6,127,2.8,3.06,.28,2.29,5.64,1.04,3.92,1065', '

API view returning { "detail": "Not found." },

class User(models.Model): user_id = models.CharField(max_length=255, unique=True) mobile = models.CharField(max_length=12) first_name = models.CharF

How to exclude future dates from excel data file using pandas?

I'm trying to limit my dataset to dates before today. Below creates a graph but the mask doesn't have any impact. Any help appreciated. df = pd.read_excel("./da

Plotting Multiple Series of Lines on the Same Plot

I am attempting to graph battery cycling data similar to this . Each line is one cycle worth of datapoints and should be one line on the graph. At first the cod

Python 3.10.2 anti-aliased fonts not smoothing in Tkinter under SUSI Linux

I have a problem with font smoothing AKA anti-aliasing not working. I have provided a small Tkinter test code snippet that shows a grid of Tkinter labels that s

AttributeError: module 'gym.envs.box2d' has no attribute 'CarRacing' / box 2d doesn't install successfully

environment_name = 'CarRacing-v0' env = gym.make(environment_name) AttributeError: module 'gym.envs.box2d' has no attribute 'CarRacing' and i did pip install b

What is the correct OOP way to add functionality to a set of classes deriving from an abstract base class?

Setting My friend told me that in OOP, you generally don't want to modify any abstract base classes in an existing codebase, because that means you have to impl