Category "python"

Why is my linked list size function not working as intended?

I used the following code to define my linked list, nodes and a few functions. class node: def __init__(self,node_data): self.__data=node_data

find max value in a list of sets for an element at index 1 of sets

I have a list like this: dummy_list = [(8, 'N'), (4, 'Y'), (1, 'N'), (1, 'Y'), (3, 'N'), (4, 'Y'), (3, 'N'), (2, 'Y'), (1, 'N'), (2, 'Y'), (1, 'N')]

How to get value from dependent combobox tkinter python?

I'm able to select both the combo box successfully but to print the second dropdown box value, I got lost. Could somebody explain how to print the Table value f

How can I speed up the routing process in OSMNX?

Say I have two taxi orders with Origin1、Destination1 and Origin2、Destination2(O1,O2,D1,D2). I want to calculate the possibility of ridesharing, so

Within a pandas DF, how can I snag last two parts of a list as a single string for conditional output?

I'm doing some modification to a CSV via pandas. For one of the situations, I want to use parse a URL into a list, grab the last two items of that list, and out

Django Form processing files

So I have the following code: # the view class UpdateDateView(LoginRequiredMixin, UpdateView): model = Date form_class = DateForm template_name = '

StringVar.get() doesn't seem to be entirely working (Tkinter)

The relevant code is this: import tkinter as tk from tkinter import ttk import quiz global menu_root def get_question(): question_input = question_respons

Having State names as names instead of numbers Python

I'm trying to have an if statement condition based on state value being equal to a certain value (0,1,2,3 etc.) Is there away to have the condition be with name

Test a decorated function in Python

I have a Python function which is decorated. @retry_if_access_token_expired(app_id) def add_something( self, *, argument1,

how can I use a function as an argument to another function,

I am trying to write a simple code that displays 3 sets of greetings in accordance to what day of the week a user inputs. I am learning about functions as I am

Python Pandas Geopy AttributeError 'NoneType' object has no attribute 'raw' , getting city, state and country from long/lat

I've looked around for a solution and tried filtering my df to where the longitude and latitude are not null but to no avail. This is my first time using geopy

How to draw button or widget upon QWidget using python-MPV on windows?

I use this library https://github.com/jaseg/python-mpv and PySide6 to embed MPV in container (QWidget) in python. I want to draw the button (or something else m

Add Django Rest Framework Login Button to Browsable API when Using Third Party Auth Library (django-rest-knox)

The login button is missing from my browsable API. I am using django-rest-knox for token authentication. My urls.py contains: urlpatterns = [ path('admin/',

How to Select cities from drop down while booking tickets using robot framework

I am new to robot framework and i tried to automate booking sites and when i tried to select cities from Yatra.com website but unable to select cities and dates

String-join pandas dataframe colums and skip nan values

I'm trying to join column values into new column but I want to skip nan values: df['col'] = 'df['col1'].map(str) + ',' + df['col2'].map(str) + ',' + df['col3'].

How can I detect long mouse clicks with tkinter?

I want to detect a long mouse click using tkinter. How can I do that? The <Button-1> doesn't help at all.

How to get the domain and string to the first slash

For example like this url = https://example.com/test/myname/myname.jpg result = re.search('(?:https?://)?(?P<host>.*?)(?:[:#?/@]|$)', url) I can get th

How is the list.index() method implemented? [duplicate]

I'm interested in the time complexity of the .index() in python function I'm trying to find the implementation in the docs but nothing so far.

how to retrieve values from plotly sunburst chart?

Plotly sunburst charts are great for visualizing hierarchical data. Is it possible to retrieve the values shown in the chart into a dictionary, or an array or s

how to retrieve the specific data from firebase realtime database using python?

I want to retrieve the specific data from realtime database in python file. I need to setup a connection first but I don't know how to set it up and then retrie