Category "python"

Trigger Cloud Storage - Dataflow

I'm starting now and I need some help, I have a custom model that I created using apache beam creating a pipeline that takes the data from a csv file from a fol

Matplotlib PathPatch Colors and Legends not Matching

I have a dataset that is a list of lists. Each list is a category to be plotted as a box plot. Each list has a list of up to 9 components to be plotted into sub

Can't two different nodes point to the same node in a singly linked list?

I'm learning circular singly linked list and trying to learn how to delete the last node. The instructor says, once you link the second last node to the first o

Tensorflow: Create the torch.gather() equivalent in tensorflow

I want to replicate the torch.gather() function in TensorFlow 2.X. I have a Tensor A (shape: [2, 4, 3]) and a corresponding Index-Tensor I (shape: [2,2,3]). Usi

Django multiple distinct values queryset for SQLDB

I'm trying to get a list of results that have distinct x and y values, but I also want to return color along with them. Since I'm using an SQLDB I'm not allowed

Two apparently identical dataclasses are not equal

I've defined the following dataclass: """This module declares the SubtitleItem dataclass.""" import re from dataclasses import dataclass from time_utils impor

mongodb command very slow

I have 3 documents like this: { _id: ObjectId("..."), _details: { _session: ObjectId("example_1"), }, { _id: ObjectId("..."), _details: { _session: Obje

Pandas - combine series with unique values, matching across rows

I'll start by dropping in my code and then explain what I'm trying to accomplish: names = [ 'ABX-B767-200BDSF (767-3A)', 'ABX-B767-200BDSF (DAR 767-3A)'

FastAPI application won't start when importing routers

I'm trying to import some authentication related routers to my main class in a FastAPI project, but if I add this import, the application starts without giving

Tkinter: move scrollbar automatically to the founded item when searching

This is a little replica of my app where I've numerous text widget create with a for loop; I've also create a search entry and option to highlight the context i

ValueError: `logits` and `labels` must have the same shape

I'm trying to use Imagenet V2 with transfer-learning for multiclass classification (6 classes), but getting the following error. Can anyone please help? ValueEr

can't figure out why my entry() widget is returning null

I've been trying to pass data from an entry box inside a function to another function but the entry.get() function seems to be returning nothing. here is a part

Dataframe in Scala

I am trying to train the model for recommendation for movie. I have a dataset which has list of all the casts, movie details with description. based on the occu

If I try to clear dynamically added tabs using clear_widgets function I get an error(mdtabs can remove only subclass of MDTabslabel or MDTabsBase

from kivy.lang import Builder from kivy.uix.scrollview import ScrollView from kivymd.app import MDApp from kivymd.uix.tab import MDTabsBasefrom kivy.lang import

AWS CDK add CreationPolicy to EC2 Instance

Question in the title, trying to figure out how to add a CreationPolicy to an ec2 instance in the cdk so that I can then send a cfn-signal command once the scri

What does "100 *" mean in "100 * df. isna().mean()"?

Can anyone explain what is the use of 100 * in the following line of code: 100 * df.isna().mean() Is it intended to get the percentage of the average value?

Rotate a Multiple Lines in OpenCV/Python

I have many lines in my opencv, I want to rotate them but Opencv does not have shape rotation functionality. It has image rotation function. I made a rectangle

Converting PyTorch Boolean target to regression target

Question I have code that is based on Part 2, Chapter 11 of Deep Learning with PyTorch, by Luca Pietro Giovanni Antiga, Thomas Viehmann, and Eli Stevens. It's

Numba Invalid use of BoundFunction of array.mean

I want to calculate the mean for the second index for each third index. @njit def mean_some_index(a): T = a.shape[2] b = np.zeros((T,T)) for t in ra

How to export Google Earth Engine images to local files using Python

I'm producing a ge image using this code: image = ee.ImageCollection(satellite) \ .filterDate(startdate, enddate) \ .filterBounds(ee.Geo