Questions tagged [python]
Python is a dynamically typed, multi-purpose programming language. It is designed to be quick to learn, understand, and use, and enforces a clean and uniform syntax. Note that Python 2 reached end-of-life on January 1st, 2020. For version-specific Python questions, add the version tag (e.g. [python-3.x] or [python-3.9]). When using a Python variant (e.g. Jython, PyPy) or library (e.g. Pandas, NumPy), please include it in the tags.
python
2,203,934
questions
0
votes
0
answers
15
views
Plotting planet position as a function of time
Ive been trying to make a simulation of planets and asteroids moving around the sun, and I found this link:
How do I plot a planet's orbit as a function of time on an already plotted ellipse?
and ...
0
votes
0
answers
7
views
Facing errors with scripts written in selenium after updating chrome to 127 ver
After updating my chrome to 127 version all my selenium test scripts started to raise error. Is anyone having the same issue?
I saw on one of the questions solution to this case by adding script ...
0
votes
0
answers
9
views
QComboBox List Design
I want to customize QComboBox list background. I need a rounded corner box when i hover. i have attached the picture current and what I need.
I am using QtDesigner for python
here is my stylesheet ...
0
votes
0
answers
11
views
crontab to run .sh file calling python script
I have an python selenium script that opens chrome and run a few automated task for me. Calling the python directly in crontab works with the line below. :10.0 is the value I get when i run echo $...
-1
votes
0
answers
8
views
How to save data using pygbag and pygame using pickle
I have a game which I have ported to browser using pygbag and it works fine while loading the data using pickle but it does not save the data, but when running localy (not on browser) it works fine, ...
0
votes
0
answers
8
views
How to Convert Camera Calibration Data to Specific Format?
I have camera calibration data in the following format from OSDaR23 dataset::
{
"streams": {
"intrinsics_pinhole": {
"camera_matrix": [
...
0
votes
0
answers
17
views
Unable to import theano backend
Im getting this error everytime i execute any jupyter cell importing tensorflow or it dependencies. Take a look at the 'value error' below.
value error: Unable to import backend : theano
I tried ...
0
votes
0
answers
7
views
How scipy deals with minimization with equality constraints?
I would like to ask if someone could briefly explain to me how python packages such as Scipy (https://github.com/scipy/scipy/) deals with constraints $h_j(x)=0$. What is the mathematics behind of the ...
-5
votes
0
answers
17
views
Encryption and Decryption using caesar sipher [closed]
I need the code that matches all the requirments so that ican complete the task to get Letter of Recomendation from certain company.
I need assistance.
Actually i tried with AI but that company is ...
0
votes
0
answers
17
views
Python Pandas multi-indexing across column levels using .loc
I am still new to python and pandas and want to know if there's a better way to go about the indexing problem I'm having. Since I've seen people doing pretty slick things on this site, beyond what I ...
0
votes
3
answers
40
views
ValueError: invalid literal for int() with base 16: b'0f 18 ' in Python with GATT
I am working with Python and the GATT library, pxexpect to handle some data, but I am encountering an issue when trying to convert a hexadecimal value to an integer. Here’s the specific error I’m ...
0
votes
0
answers
18
views
What is this "extra padding" from the Entry widget from Tkinter?
Take this simple code:
import os
import tkinter as tk
root_window = tk.Tk()
root_window.geometry("200x200")
root_window.columnconfigure(0, weight=1)
root_window.columnconfigure(1, weight=1)...
-1
votes
0
answers
10
views
innerInstructions ERROR on SOLANA, using python script
ERROR:main:Transaction failed: {'code': -32002, 'message': 'Transaction simulation failed: Error processing Instruction 0: invalid instruction data', 'data': {'accounts': None, 'err': {'...
-7
votes
0
answers
34
views
I cant understand this python script clearly?
Python script to load .dat files
import csv
from django.core.management.base import BaseCommand
from recommender.models import User, Artist, Tag, UserArtist, UserTaggedArtist, UserFriend
import os
...
-3
votes
0
answers
12
views
A way to mitigate seeing texture edge in 3D texture in OpenGL
I am trying to implement a texture based volume rendering using python and OpenGL.
I was successful in loading the data file and displaying the 3D volume using OpenGL 3d texture. I applied blending ...
0
votes
1
answer
15
views
How to check wether two mean values are significantly different?
I have two distributions with a size of ~120 and ~86.000 elements. I would like to check wether the mean value of the two distributions are significantly different.
I found, that I can use a Welch’s t-...
0
votes
0
answers
8
views
Monitor progress of python from within c# using python.net
From within c#, I am executing python.net to build a RandomForestClassifier. After I have loaded the data and put it in a format for the classifier, using python.net I execute:
scope.Exec("...
0
votes
0
answers
3
views
INSTAGRAPI How can I check if I have liked/commented an specific media?
My real goal is to comment only on the posts that I've not commented yet and I thought about checking if I have liked it or not because every time I comment on a media a like it.
I can't find a ...
-5
votes
2
answers
34
views
what is the meaning of index[",i,"] in a loop?
what is the meaning of this part of my code?
my code haven't any problem but i wanna know what is the meaning of this part of my code:) thank you!
orginalString = input("enter the word: ")
...
0
votes
2
answers
21
views
How to annotate type of an `OrderedDict` that is initialized with literals?
Suppose I have the following:
from collections import OrderedDict
from dataclasses import dataclass
@dataclass
class HelloWorld:
x: OrderedDict[str, int]
a = OrderedDict([("a", 0), (&...
0
votes
0
answers
21
views
Pycharm function return typehint triggering false warning with sqlalchemy?
This Pycharm warning is driving me crazy :)
def get_player_by_id(session: Session, player_id: int) -> Player:
player = session.query(Player).get(Player, player_id)
return player
returns no ...
-4
votes
0
answers
38
views
FOR loop Project [closed]
I am in a python coding class. I was asked to do a FOR loop project where the project reads the number or the name of an employee and pops the name with the pay of the employee. The range is 5.
These ...
0
votes
0
answers
46
views
Document AI - Processor location issue
I'm using a Mac and I have created a simple Document AI processor on the Google Cloud Platform (PDF splitter). This processor was trained, tested and deployed.
I'm now desperately trying to make use ...
0
votes
0
answers
19
views
Trouble drawing a rectangle in kivy on a float layout screen
I do not understand kivy at all. I've watched so many tutorials and examples and for the life of me I still can't accomplish the simple task of drawing a rectangle on my kv screen. I've been trying to ...
0
votes
0
answers
15
views
Report contains control characters when run in cron
Running on Raspberry Pi with bookworm.
I have some python code, "inxi_test.py"
#!/home/pi/.venv/bin/python
import subprocess
ret = subprocess.run(['inxi -F'], shell = True, ...
0
votes
3
answers
50
views
Python, pandas parse number and string from string
In Python, I want to parse a string and return the numeric portion (may or may not have decimal point) as a float and return the suffix as a string. Examples are:
7.1inch -> 7.1, inch
7.1” -> ...
0
votes
0
answers
5
views
Alicat Mass Flow controller setup MCS-1SLPM-D-MODTCPIP-PCA14
hello I am currently working on a MFC from Alicat using Pymodbus and I keep encountering this error
Successfully connected to the Modbus server
Reading Mass Flow from address 1209
Unexpected number of ...
0
votes
0
answers
11
views
RuntimeError: mat1 and mat2 shapes cannot be multiplied (100x768 and 2048x768)
I am trying to find similarity scores between the encodings of the image and prompt (which is the label of the image). I am new to machine learning, I realise that there is an issue with some shape of ...
0
votes
0
answers
12
views
I am trying to add pytest to my test but I got collected 0 items message in terminal
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.edge.service import Service
import pytest
@pytest.fixture()
def wrong_login_test():
website = 'https:/...
-2
votes
0
answers
17
views
how to iterate efficiently through files in order to concatenate them to one dataframe
The data is the physionet 2019 data. It consists of about 40 000 patient records. One file stands for one patient and i want all data in one dataframe.
I have read that when I want to concatenate ...
0
votes
0
answers
13
views
Normalizing Dataframe with a json column
Hi i am looking for a efficient way to normalise a data frame that contains a column with json data.
i get json response from a website that is saved as a dataframe.
The structure is shown below
enter ...
-2
votes
0
answers
22
views
Python needs Windows Long Path
I tried to run this install: pip3 install msgraph-sdk
And it gave me this error:
It says I need to enable the Windows Long Path using this link:
https://learn.microsoft.com/en-us/windows/win32/fileio/...
0
votes
1
answer
26
views
Why the warning: "FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas"?
I am not understanding why this particular warning is being raised, given the circumstances. When applying a function to a numeric series, it raises FutureWarning: Setting an item of incompatible ...
0
votes
0
answers
10
views
Wexpect ssh authorization script
I have this code and it is not outputing anything and is not running the script
import wexpect
import sys
child = wexpect.spawn("ssh user@ip")
child.logfile = sys.stdout
child.expect("...
0
votes
1
answer
21
views
Using R to generate lifespan plots
I have a dataset that records the lifespan and generation time of individual cell that I would like to plot as below:
Example_RLS_plot
Reference:
https://doi.org/10.1186/s12951-022-01379-9
Here is my ...
0
votes
0
answers
9
views
How to Use Pydantic Model as Query Parameter in Litestar GET Route
I’m trying to create a GET route with Litestar that utilizes a Pydantic model as a query parameter. However, the serialization does not work as expected.
Here is a minimal example that reproduces my ...
0
votes
2
answers
21
views
isinstance() arg 2 must be a type, a tuple of types, or a union
I'm getting an error message when trying to train my model, but some reason its giving me the same message every time I alter it.
Here is the code:
# Define training arguments
training_args = ...
0
votes
0
answers
11
views
Why can't I install NLTK even though I checked the version numbers of numpy, scikitlearn, and scipy?
I ran the code
import nltk
from nltk.stem import PorterStemmer
from nltk.tokenize import word_tokenize
nltk.download('punkt')
If I run my code, I see the following:
File "sklearn/utils/...
0
votes
0
answers
8
views
Overlay a polar matplotlib axis over a geopandas map
I would like to overlay a polar axis over a map of a GeoPandas GeoDataFrame centered at a specific point. The ultimate goal is for the plot on the polar axis to be exactly centered at the point. I ...
-2
votes
0
answers
17
views
How would I get the sprite sheet animation to load at different key board inputs? [duplicate]
I am making a videogame in python that is based on an adventurer. I got the adventurer to move around with a jump-cooldown and to be able to move left or right.
import pygame
from sys import exit as ...
0
votes
0
answers
11
views
Python SSL Verify = False Not Working w/ Trino
I'm encountering a super weird issue, where while using trino, the verify=False argument doesn't work when running in a separate python thread / process. When running the script directly, it works ...
0
votes
0
answers
8
views
Snowflake python worksheet with package from stage (Office365-REST-Python-Client)
I know very similar questions have been asked, but all attempts to import this non-Anaconda package into a Snowflake Python worksheet give the error "ModuleNotFoundError: No module named..."....
-1
votes
0
answers
24
views
Why my python Maya code crashes the second time execute it
I'm trying to create a simple toolkit for my utilities for speeding up my workflow in Maya.
The second time I execute my code it always crashes and I'm not able to find the cause of the error.
From my ...
0
votes
1
answer
19
views
Open with Python an R data.table saved as metadata in a Parquet file
With R, I created a Parquet file containing a data.table as main data, and another data.table as metadata.
library(data.table)
library(arrow)
dt = data.table(x = c(1, 2, 3), y = c("a", "...
0
votes
1
answer
21
views
Trying to get all songs in playlist with over 100 songs using Spotify API
I'm trying to return a list of song names in a specified playlist using the Spotify API. I was able to get it to return over 100 songs, but it is short by a seemingly random amount each time. On one ...
0
votes
0
answers
13
views
Adding Node.js and VSCode extensions causes Package Conflict
I recently downloaded Node.js on my machine and set it up with all the default options. I also added ESLint, Nx Console, Playwright Test, Prettier, Jest Runner via Visual Studio Code extensions. After ...
-3
votes
0
answers
47
views
Syntax for calling a function from a class in python [duplicate]
I am super new to OOP and was just trying to test out some very simple functions that will sort an array inside of a class and I am getting "None" as my output instead of the sorted list.
...
-4
votes
0
answers
48
views
How to extremely quickly modify values of a multidimensional numpy array?
I am working on a project that involves tracking thousands of points across a (640, 640) grid.
When tracking these points, I store their movement in a format of a linear array of vectors explaining ...
0
votes
0
answers
21
views
When I try rendering JavaScript using HTMLSession it gives me an error
I tried rendering JavaScript using HTMLSession, yet when I tried it gave me an error.
>>> r.html.render()
Future exception was never retrieved
future: <Future finished exception=...
0
votes
0
answers
16
views
Read Large JSON File and Flatten Lambda
I have a lambda function that reads in a json file and flattens it so that I can convert it to parquet and it'll be easier to read the data. The issue I'm having is that some of the files are too ...