Category "python"

How to deal with SettingWithCopyWarning in Pandas

Background I just upgraded my Pandas from 0.11 to 0.13.0rc1. Now, the application is popping out many new warnings. One of them like this: E:\FinReporter\FM_EXT

I want to remove the first ( ) and it´s unkown content every time i loop

I tried the next code but it did not work: info = ["Mark(Sat)", "James(Sun)", "Robert(Sun)", "John(Fri)"] for x in info: info.remove(info[info.find("("):i

Best way to manage Terraform apply infra -AWS batch- run a script (could take 1hr to 1day) - destroy infra

Hi All I am planning to build a system for my team where we can start a AWS batch infra - run a task - once job done destroy the infra. I am thinking of : Make

Mypy marks error when using TypeVar type inside TypeDict derived class

I have the following code: WriterMeta = typing.TypeVar('WriterMeta', GSheetWritable, S3Writable, LocalWritable) class WriterDesc(typing.TypedDict): name:

pyenv global x.x.x does not update the python version on linux

I have pyenv installed and have downloaded python versions 3.6.15 and 3.7.12. When I run pyenv global 3.7.12 python -V the output is: Python 3.10.2 pyenv versi

HTTP Error 401 unauthorized when using python requests package with user-agent header

I am trying to reverse engineer a web app. So far, using the inspect tool on my browser, I have managed to log in the website using python and use multiple part

Can't load a transformer model from huggingface

I was trying to load a transformers model from huggingface to my local jupyter notebook and here's the code from transformers import AutoTokenizer tokenizer = A

pandas.core.indexing.IndexingError: Too many indexers in scikit-learn agglomerative clustering

I have this data set: col_index Sample FID SNP1 SNP2 SNP3 SNP4 SNP5 LiverCysts ESRD_Aug2020 Renal_Survival_Aug2020 Group 1 23 0 1

Python Discord Bot Commands Decorator within classes

Hey I was coding a discord bot, however I can't figure out how to write the commands decorator, I think that's because I am putting all the code in a class, wit

My Tkinter Python code returns "I/O operation error"

I am trying to create a code that will detect cursor coordinates upon user's entry and exit of the Tkinter window. However, I am not getting an output the first

Sip installation fails --plat-name not recognized correctly

I was trying to use pip to install pyqt5 on my windows 10(64-bit) sytem. Before this I upgraded to python 3.10.4. The Installation using pip failes during the i

Why is my function not printing the try-except-else result?

What is wrong with my code? I am not being able to retrieve data about the age range. I am working with a CSV file but having problems with the try-except-else

Drastically results variation when change condition in _gradient_descent tSNE scikit-Learn

I am working with some noisy data to classify the spectrum of light curves using the tSNE instance in scikit-Learn. The problem comes when I try to understand h

How to remove repititve pattern from an image

I have to clean images for my OCR. Some of them have text of quite pale gray color above complex background. After some modifications I've got result like this

get a dictionary of an attribute in all instances

class Players: def __init__(self, username, score): self.username = username self.score = score If I create a class and some instances of it with diffe

Can you connect a controller to Pygame Zero?

I have programming as a subject in school, and this is our last project of the semester. For our last task we are going to use replit.com, which use PygameZero.

numba: underlying object has vanished

I am experiencing the following exception when using Numba. What does it mean, and how can it be avoided? It occurs in the middle of a convoluted function, so u

how to fill a row in a subcolumn inside a multi column dataframe?

I have a multicolumn dataframe called full_week that the first column is the employees names and the other columns are columns with each weekday name starting f

Odd Linearization of Pydrake Body with Bushing Constraint

I'm currently simulating a four-bar linkage with the bottom link bolted to the ground, and I am using a bushing constraint. I need to use the Linearize function

How to tag nodes implicitly in yaml (PyYAML)

Consider this yaml file: !my-type name: My type items: - name: First item number: 42 - name: Second item number: 43 There is one top level object t