October 21, 2024
Chicago 12, Melborne City, USA
python

NiceGUI Table Dynamic Title

I’m using NiceGUI and trying to create a table with a dynamic title. I want to be able to change the title of the table dynamically, just like I can update the columns and rows properties. # Create the table with an initial title existing_table_route = ui.table( columns=[], rows=[], row_key='Route/Variant', title="Existing - Rate / SKU

Read More
python

Using Python 3.9, How do I get in MS excel ALL physical addresses from the URL -> https://www.tamoil.ch/en/store-locator

I would like to get all physical addresses in MS-excel from this url [https://www.tamoil.ch/en/store-locator]. The spreadsheet only has a header, but no output from the code. import requests from bs4 import BeautifulSoup import pandas as pd # Send a GET request to the website url = "https://www.tamoil.ch/en/store-locator" response = requests.get(url) # Parse the HTML content

Read More
python

Python selenium headless browser window

This is a block of code of my project from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.edge.service import Service from selenium.webdriver.edge.options import Options import time def extract_data(self, usrname : str): self.edge_options = Options() self.edge_options.add_argument("--headless") self.usrname = usrname service = Service(executable_path=r'C:\web\msedgedriver.exe') self.driver = webdriver.Edge(service=service) self.driver.get(f'https://leetcode.com/{usrname}/') I am using the –headless open also but the

Read More
python

Python dependencies in kubeflow spark operator

I wanted to ask if there is a way to use python as a .wheel or .egg or just .py dependency in kubeflow spark operator. The resulting file i have in mind would look something like this, the dependecy would be either under jars or files, i presume files would make more sense: apiVersion: sparkoperator.k8s.io/v1beta2

Read More
python

Fine-Tuning segment anything model

I’ve been trying to fine-tune the SAM model but most of the tutorials I found require us to provide prompts even after fine tuning. Is it not possible to fine tune the model so that it can work on that specific data set without us providing prompts? I tried following a tutorial but it did

Read More
python

Converting .py file to Databricks with Markdown

I wish to convert a python .py file into one that can be run on Databricks with multiple cells. I don’t wish to do it in the GUI, as I’ll eventually want an automated process for this. What is the minimal code to create a title cell and then have the rest of the code

Read More
python

Schema replacement is not working in SQLalchemy

I have the following Python code which uses SQLalchemy stmt = select(Lclzone.sequence).where(Lclzone.refno == cReference) _sequence = self.session.execute(stmt).scalar() It generates the error; Unable to process fmb73 error: (psycopg2.errors.UndefinedTable) relation "public.lclzone" does not exist LINE 2: FROM public.lclzone ^ [SQL: SELECT public.lclzone.sequence FROM public.lclzone WHERE public.lclzone.refno = %(refno_1)s] This is application has multiple schemas. I need it

Read More
python

mysql-connector-python self._cmysql.connect(**cnx_kwargs) crashes the application

I have issues with my PySide6 application. In the application I am using mysql-connector-python libary and trying to connect to our private Mysql server. I have noticed that on some computers, my application will run without any issues, while on other PC’s it will crash with Process ended with exit code 3221225477. I have run

Read More
python

Pandas DataFrame – KNNImputer Algorithm Implementation

I have a dataset set with missing values and I want to fill them groupwise. I used the groupby() method and it works fine. But the same thing I want to do using the KNNImputer algorithm. Code I have done so far(using groupby() method which worked as expected): null_columns = df.columns[df.isnull().any()] # filling median values

Read More
python

Issue Displaying All Colors of a Product Variant in Django Template

I’m working on a Django application where I have a Product model with a many-to-many relationship with a Color model. I want to display all colors associated with a product variant on its detail page. However, when I click on a specific color (e.g., white), the page only shows that color instead of all available

Read More