Quantcast
Browsing all 13981 articles
Browse latest View live

Python List Gives an Error of Numpy Array?

I have a list which is 2 dimensional and has elements like ([0,1,2],[3,4,5]). Type of its elements is numpy.ndarray. I am trying to delete 2nd columns of each element. When I check its type, it returns...

View Article


Python : XML file downloaded from S3 full of string escaping characters

I have a number of XML files that I have added to S3 (localstack sever). I can view these files through Cyberduck and they are valid xml files. However, when I download the objects, the XML data is...

View Article


Joining polars dataframes while ignoring duplicate values in the on column

Given the codedf1 = pl.DataFrame({"A": [1, 1], "B": [3, 4]})df2 = pl.DataFrame({"A": [1, 1], "C": [5, 6]})result = df1.join(df2, on='A')result looks likeshape: (4, 3)┌─────┬─────┬─────┐│ A ┆ B ┆ C ││...

View Article

Image may be NSFW.
Clik here to view.

django.contrib.auth.views LogoutView not working [duplicate]

I am using latest version of django and I want to create a LogoutView using builtin system. But this is giving error when I try to run the server, and not working LogoutView.Below is the urls.py...

View Article

Finding the total probability under a shape in a bivariate KDE plot in Python

I have a set of points stored as (x,y) values. My goal is the map these onto a coordinate plane and create a continuous PDF distribution.I would like to apply polygons to the figure and get the total...

View Article


Selenium can't input a text in a field on the website

I tried to put a string in a txt-field on the following site with the following code:import timefrom selenium import webdriverfrom selenium.webdriver.chrome.options import Optionsfrom...

View Article

Hi I am getting this error while trying to run the pyspark script. Can...

bash +x spark-submit C:\Users\vasee\OneDrive\Desktop\vaseem.py/mnt/c/Spark/spark-3.5.0-bin-hadoop3/bin/spark-submit: line 21: ./find-spark-home: No such file or...

View Article

TypeError: Singleton array in nested stratified cross-validation

I am running a nested CV with stratification at both inner and loops on a binary classification task using a small sample. I am able to run these models without stratification on a dataset with...

View Article


Pytorch how to efficiently calculate gradients of all outputs with respect to...

I have a relatively simple requirement but surprisingly this does not seem to be straightforward to implement in pytorch. Given a neural network with $P$ parameters that outputs a vector of length $Y$...

View Article


Django logging requests

I'm using django 1.11 in aws elastic beanstalk and I've been trying to get my app to log with no luck . . .I have these in my settings.pyLOGGING_CONFIG = NoneLOGGING = {'version':...

View Article

How to chain command line function in Python file open() like Perl does?

We are in the process of rewriting a lot of Perl code in our infrastructure to Python. The syntax is similar and it reads similarly. However, there are a number of subtle differences that makes the...

View Article

Does passing a string from Rust to Python like this cause memory leaks?

I'm currently tinkering with interfacing between Python and Rust for a hobby. (Clearly I have too much time on my hands.) The problem I'm working on right now is passing large integers between the two...

View Article

("Django tried these URL patterns... The empty path didn't match any of...

I am using Visual Studio Code for a basic Django project and whenever I try to run the server it gives the error:Page not found (404)Request Method: GETRequest URL: http://127.0.0.1:8000/Using the...

View Article


Fixing an element with itertools.permutations()

I have a list of tuples of the form route_cost = [(route, vehicle, cost),...]. Consider that I have 2 routes and 3 vehicles, I want to find the cheapest allocation of 1 vehicle to route 1 and 1 vehicle...

View Article

ImportError: cannot import name 'model_lib_v2' from 'object_detection'...

**Hey guys, currently doing tensorflow object detection and stuck because of an error. Already tried all the method in the internet, still not working.**I use tensorflow == 2.10.0, the model is...

View Article


Expected a 2-dimensional container but got

I have the following sample code, where I need to draw 2 lines, as shown in the plot below:anomalies = anomaly_df.loc[anomaly_df['anomaly'] == True]#Plot anomaliessns.lineplot(x=anomaly_df['Date'],...

View Article

How do I type hint a return type of one function based init if init is...

I have a class that accepts either ints or floats in it's init but all must be int or float so i am using typing.overload to achieve that and I want to be able to type hint the return of a function...

View Article


How to solve "Could not find any Python installation to use" with docker node...

Before I added bcrypt to my package.json, everything was working fine. Now, I get the error message below.This is an excerpt of my package.json:"dependencies": {"bcrypt": "3.0.6","express":...

View Article

Pytorch advanced indexing with list of lists as indices

Here is some python code to reproduce my issue:import torchn, m = 9, 4x = torch.arange(0, n * m).reshape(n, m)print(x.shape)print(x)# torch.Size([9, 4])# tensor([[ 0, 1, 2, 3],# [ 4, 5, 6, 7],# [ 8, 9,...

View Article

"The truth value of an array with more than one element is ambiguous" when...

TL;DR: I create a new instance of my equinox.Module model and fit it using Optax. Everything works fine. When I create a new instance of the same model and try to fit it from scratch, using the same...

View Article
Browsing all 13981 articles
Browse latest View live