Category "python"

Why i'm getting the following error? ValueError: invalid literal for int() with base 10: ''

Here is the code from time import sleep import keyboard # Condição de partida da máquina while True: if keyboard.is_pressed('ENTER'):

how to plot 2d condition function

I want to plot a 2d condition function, and the code as below: from numpy import exp,arange from pylab import meshgrid,cm,imshow,show def z_func(x,y): zPar

Capitalize specific indices of string using awk or python

I have an input file where each line contains 99 lowercase letters, bccdddcdccddddddabcdabcabdbacbdcaaccbbcabacbccabcacbcdcccbdbacdcbbcbcbcccacadaaccababadbcbaa

Handle many models using graphene in django

In my django project i have many different models which i want to query using GraphQL. For instance: class Country(): name = CharField(max_length=255) clas

Framerate affect the speed of the game

I am practicing on pygame and I was wondering how can we do so that the framerate does not affect the speed of execution of the game I would like FPS to not be

Validate user input with data in .txt file

I have searched and searched and tried everything. I am creating a game where the user will input a pre-assigned pin and I want to validate that pin against a

Xarray: grouping by contiguous identical values

In Pandas, it is simple to slice a series(/array) such as [1,1,1,1,2,2,1,1,1,1] to return groups of [1,1,1,1], [2,2,],[1,1,1,1]. To do this, I use the syntax:

How Can I Run Commands in a Python Environment Over SSH from a Python Script?

I am currently working with Create2 Roombas. They are connected through serial to USB connections to Raspberry Pis that I control from my laptop through SSH. I

Error: "ValueError: could not convert string to float: 'Private Sector/Self Employed' "

Output- "ValueError: could not convert string to float: 'Private Sector/Self Employed' ". I need help with this error as I get this error consistently import nu

is there a way to cluster tweets after vectorizing them?

I need to cluster tweets based on similarity between them, I am using dec2vec to vectorize them and now I need a way to cluster this vectors, also I tried kmean

'ListWrapper' object has no attribute 'get_config' error when doing gridsearch

I have to do grid search on my DNN. But I am getting an error on GridSearchCV function. Here is the code for creating and compiling the model I used and also wh

Python equivalent of `final field` in java in dataclass

Is it possible to have something like class MyAbstract { final int myFieldSomebodyHasToDefine; } class MyAbstractImplementation extends MyAbstract { fin

Python - Matching close strings in two separate arrays

I have two different arrays populated with a number of string values and I would like to compare the two arrays and find the matches. The main problem is that t

how to check if the 2d array contain the requirement, and if yes, return the toal score in python

I have a 5 * 5 two-dimensional array, and a dice will be thrown 25 times. For each throw, the user needs to put the value into the two-dimensional array. Becaus

Can I write posts for a personal Django blog website in static html files?

I'm pretty new to Django and have been experimenting making my own personal blog. General question I get that I can specify my blog post structure in models.py

What could be wrong with a Pandas DataFrame?

I couldn't make head or tail of this: I have a function that reads a bunch of csv files from a S3 bucket, concats them and returns the DataFrame: def create_df(

scraping NYT mini crossword stats gives 403 forbidden URL error

I'm trying to scrape my NYT mini crossword stats to then update a google sheet. But I'm having trouble with the login portion of the code. Here's my code so far

Global variable is not updated if it is from other .py file

As you know, the code: var = "flower" def update(): global var var = "forest" update() print(var) will properly modify the variable var, but if you do

python logging library init.py returns keyerror and acquireLock() is NoneType

Im absolutely not sure which library is causing this or what is causing this but i really would appreciate some help. Although the error isn't messing up with t

When I convert the obtained road network data into a geodataframes structure, why does the list element appear in the highway column?

import osmnx as ox G = ox.graph_from_place('成都市',network_type='all') G = ox.project_graph(G) ox.plot_graph(G) # 将图形