Skip to content
Advertisement

Tag: python

Multiple problems generating a text file

I am making my first interface with Pyqt, using “designer” and Python to configure it.The function def clickconector return the form fill and def radio_value return if the job is pending or finished (“pendiente” or “terminado”). clickconector and radio_value* functions are written correctly, but I have problems with def text_file function. Problem #1 : For some reason the generated file

How to loop through a column in csv using python

I’m currently making a questionnaire on csv and programming using python. I’m trying to make my code loop through the first column in my spreadsheet and to only print the questions which have the key corresponding to what the user has chosen in this case either 1 for earth or 2 for animals… The following is the code i have

Reproducing a 2d histogram in Python

I’m working with a very large dataset in Python, so I’m trying to use histograms instead of arrays (the arrays get way too large for saving/loading/mapping). I’m crawling over a bunch of files and pulling information from them, and I would like to then take the information and remake the histograms afterwards. I can do this with a 1D histogram

Initiaized class member in pytorch module

When declaring a model in pytorch, having a model class member variable declared and initialized mysteriously prevents it from being populated in the constructor. Is this expected? If so, why? Testing code below, with example models with a component member variable. The initialization value of the component (e.g. None, a number or a Tensor) does not change the behaviour. Answer

Role auto-assignment bot

The bot does not issue a role when the user connects (there are no errors either) code: Answer Starting from Discord 1.5, you now need to pass in Intents. Everything is explained in the API docs (link). In your case you need the members intent. Remember to also enable it on your bot’s application page (as is explained in the

Python DataFrame Filtering and Sorting at the Same Time

Hi I have a data frame with column as following: ‘founded’ and ‘company name’ What I’m trying to do is filtering the year founded > 0 and then sorting by company name, ascending. I’m looking for a code similar to this But I got this error and at the moment I have this code: Are there any way that I

Python how to read() and convert to __int__

I have a text file that contains the XP of the player in it. Every time the game starts: , so that the XP of the player sets to the only item in the file. And at the end of the file (around pygame.quit()) it has this code: But whenever I try to do XP += (some number) in my

How to change room in this game (arcade Python)

I am developing a simple platformer game using the arcade game library of Python. I am still new to this, but I have tried to use as much object oriented programming as I could. I have successfully setup two “rooms” or levels of the game. However, I cannot figure out how to move to the second room after finishing the

Advertisement