Category "python"

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

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

Halo MCC Discord Rich Prescence application spits out multiple errors

I have been using this Halo MCC Discord Rich Prescence application: https://github.com/Gurrman375/HaloMCC-DiscordRPC for awhile and for about a year now it's be

Get owner of a file using python on windows system

I want to extract the owner of a file within a python3 script on a Windows system. When I run: os.path.expanduser(fp) or os.stat(fp).st_uid I receive a 0 for al

Blender Crashes when i use Python Script

I have a python script which works fine when I run in text editor. But I want to create Addon for that script. I am not from coding background so do not have mu

How to retrieve all values of a specific attribute from sub-elements that contain this attribute?

I have the following XML file: <main> <node> <party iot="00">Big</party> <children type="me" value="3" iot="A"> &

Generate colored image in Python using ndarray

I am using the following code to generate a colored filter on an image in Python. However, it gives me a full green/blue/red image. I want to decrease the inten

How can I handle multiple lines at once while reading from a file?

The standard Python approach to working with files using the open() function to create a 'file object' f allows you to either load the entire file into memory a

How to read excel file with multiple sheets from python? I got error saying 'pandas' has no attribute 'excel'

At first, I wrote: import numpy as np import pandas as pd import glob all_data = pd.DataFrame() for f in glob.glob("*.xlsx"): df = pd.read_excel(f) all_

Is it more profitable to read files too large line by line or read all files in one step with pandas Dataframe, maybe?

I have run my script in an instance of 18Gb of ram, 4 CPU, and 20 Gb of a disk in both use cases My use case is (read line by line): Read line by line and proce

Can I use a python argument in a postgres variable for a query call?

I want to create a python function that takes a start date and end date as arguments. I want the dates passed to the function to be the start date and end date