Category "python"

Error tokenizing remove pattern re.findall

I have error like this while cleaning text, i just tried to following code from web def remove_pattern(text, pattern): r = re.findall(pattern, text) fo

how to plot pairs in different subplots with difference on the side

I want to make a plot in seaborn but I am having some difficulties. The data has 2 variable: time (2 levels) and state (2 levels). I want to plot time on the x

How do I display a Django form correctly using ListView

I am writing a simple app to track sales leads based on the Django tutorial "Writing your first Django app" (https://docs.djangoproject.com/en/4.0/intro/tutoria

How to assign a list that is set as a variable to another list (python)

In building a config file, I'm trying to add a list to another list. I'd rather not use any functions like append or python logic in this config file. Some exam

getting an error while fetching data from database (mysql). n="+".join(n) TypeError: can only join an iterable

conn = mysql.connector.connect(host="localhost", user="root", password="", database="Attendance") my_cursor = conn.cursor() my_curso

Speeding up Python Tkinter Program

I have programmed an App with Tkinter on Python, that reads out a number of consecutive XML-protocols of a (literary) writing process and visualizes the same pr

Select agents by a condition out of the model and change that attribute in mesa?

For an agent based modelling I'm doing with mesa & mesa-geo I need a way, to select and manipulate the agents out of the model.py. For example, if you take

F5 SDK - SSL Insecure request

Is there a way to ignore SSL? I'm running Python 3.10.1 code: from f5sdk.bigip import ManagementClient device = ManagementClient('10.10.17.127', user='admin',

Search Twitter API for tweets. Save and clean them up to a new txt file

I'm trying to get the below done, but keep getting an error. I know that I'm getting the information from Twitter because my monthly usage increasing. Any help

WebDriverException: failed to wait for extension background page to load: xxx Selenium

When I try to add an extension on my script like for example "Selenium" I get this error message: selenium.common.exceptions.WebDriverException: Message: unkn

Generating same numbers in array of Objects

Ive got problem with generating same numbers in my code im not using any seed and evry, the object is created in the loop it has same numbers inside array. clas

How to open url from altair chart in a new tab (href)

I've made an altair scattered chart with links. It works perfectly from my Jupyter Notebook. Problems start when altair is in Streamlit environment. As I invest

How to use nn.TransTransformerEncoder from pytorch

I am trying to use PyTorch's '''nn.TransformerEncoder''' module for a classification task. I have data points of varying lengths i.e I have sequences of differe

How to create a dictionary, where the key is the key of a dictionary of lists and the value is the longest list

I have this dictionary of lists of dictionaries: dict_countries ={'uk': [{'datetime': '1955-10-10 17:00:00', 'city': 'chester'},{'datetime': '1956-09-10 13:00:0

How to access shared google drive from remote server's jupyter notebook?

I have a big dataset on my shared google drive. I want to access/read the dataset from a remote server's jupyter notebook to train my deep learning model. I can

Groupby hours +/- some integer of additional hours

I have a data frame consisting of some columns, where the index is datetime, i.e. it looks something like: df = col1 col2

python get sys.platform values

i am interested in the list of values that sys.platform returns. i came across this answer, but the list was given without any reference to see that it is indee

python: initialize class members

I am using class to scope data (yap, maybe I should move this to a 2nd module). This class will contain a lot of "constants", however some of them need to be ca

How to use a variable/function from a class instance in a differrent class with kivy?

first, I'm new here, so don't hesitate to correct me if I act innapropriatly ! I'm making a sudo turn based RPG combat to train with kivy tools and I've come in

100 Days of Code - 37 - Love Calculator - What's wrong with my code?

Newbie here and I've taken a shot at a Love Calculator using the logic in my brain and here is what I got prior to some learning tweaks from the 100 Days of Cod