Quantcast
Channel: Active questions tagged python - Stack Overflow
Browsing all 23101 articles
Browse latest View live
↧

Pytorch TypeError: only integer tensors of a single element can be converted...

I am trying to use pytorch in a case for nlp binary classification and i need help to finish the neural network training and validate. I am newbie and this is my first time using pytorch, see the code...

View Article


Forward Messages from Telegram to Discord via webhook

I hope someone here can assist me with an issue I'm encountering in my Discord bot project. I'm working on a bot that should forward messages sent in a Telegram channel, where the bot has been added,...

View Article


Langchain UnstructuredURLLoader shows Libmagic Unavailble

Attempting to use UnstructuredURLLoader but getting a 'libmagic is unavailable'.I have:Install langchainInstall unstructured libmagic python-magic python-magic-binInstall...

View Article

Problems with importing modules in Python

So this problem took already so much time in my life that I would really much would like to solve this once and for all. I changed the directories in my project and now everything is broken again, so...

View Article

Python loc multiindex series with repeated keys

I have a multi-index Series defined like this:s = pd.Series([1, 2, 3, 4, 5, 6], index=pd.MultiIndex.from_product([["A", "B"], ["c", "d", "e"]]))sA c 1 d 2 e 3B c 4 d 5 e 6dtype: int64I want to evaluate...

View Article


Image may be NSFW.
Clik here to view.

Lengths of overlapping time ranges listed by rows

I am using pandas version 1.0.5The example dataframe below lists time intervals, recorded over three days, and I seek where some time intervals overlap every day.For example,one of the overlapping time...

View Article

AVLtree insert infinite loop

im trying to implement insertion in AVLtree , the insertion works on small number of insertions , but when i try random insert there is a loop in node_position , a small number of insertions with small...

View Article

How can modify request.data in django REST framework

I am using Django REST Frameworkrequest.data = '{"id": "10", "user": "tom"}'I want to add extra attribute like "age": "30" before sending it to further like request.data = new_data response =...

View Article


Can't import a installed package in Python with jupyter notebook

I have a strange problem. I want to use the package "copulas" in Python (https://sdv.dev/Copulas/). For that I first install it by using!pip install copulasThe output isRequirement already satisfied:...

View Article


How to enable CORS in FastAPI for local HTML file loaded via a file:/// URL?

I am trying to enable CORS in FastAPI on my localhost with credentials enabled. According to the docs we must explicitly set allow_origins in this case:from fastapi import FastAPIfrom...

View Article

Login program only reading last line of text file

As a continuation of my previous question Creating a login program using a text file, my program is trying to validate the username and password that a user enters and if the username and password...

View Article

How does "import pythoncom" find the right files?

NB: I know the proper solution is just to do pip install pywin32 and let everything be done automatically, but here this question is about the internals of pythoncom.When doing import pythoncom, it...

View Article

populate pandas dataframe using csv file

I have two files:File1: An empty dataframe with only a header. (the data frame I wish to populate)item A B C D E F G HFile2: A CSV file with space-delimited elements with uneven column numbersitem1 A B...

View Article


Updating a Mysql database using an external variable

I am trying to update (not insert) a python variable into a Mysql database. Searches show me many examples of the UPDATE being set to a constant,and this works for me: fragmentmycursor.execute("UPDATE...

View Article

Solve matrix and vector multiplication with parameters instead of values...

I want to look at some vector operations and see which matrix elements go into which vector, e.g. if I define a matrix with elementsmat = [["a11", "a12"], ["a21", "a22"]]and a vectorvec = ["v1",...

View Article


The database model and the created database definition is different

The line below contains the definition for the database table Notes:class Notes(db.Model): id = db.Column(db.Integer, primary_key = True) title = db.Column(db.String(1000)) description =...

View Article

PanelOLS and Variance Decomposition

Maybe this question is trivial for some but I would need some hints on how to execute a variance decomposition for a PanelOLS model. Consider the following regression :\text{Target}{ijt} = \alpha +...

View Article


else if statement in python always provides the same result [closed]

I am working on an exercise to learn Python. The aim is to print out either 0, 20 or 100 based on an input, but the statement always gives me a "100":x = input("what is your greeting?").lowerx =...

View Article

Creating conda environment using DEEPLABCUT.yaml

I ran the command conda env create -f DEEPLABCUT.yaml to create a Conda environment for DeepLabCut, but it ends with an error:Collecting networkx>=2.6 (from deeplabcut[gui,tf]->-r...

View Article

WebSocket Disconnect: No route found for path 'ws/chat_app/3wVCio/'

When I try to connect to handshake with my WebSocket, I'm getting the following error in Django terminal:python3.12/site-packages/channels/routing.py", line 134, in __call__ raise ValueError("No route...

View Article
Browsing all 23101 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>