When using BeautifulSoup, I am attempting to extract data from the paths below: <div class="col-md-8 queryResponseBodyValue">2023-02-02</div> <div class="col-md-8 queryResponseBodyValue">2003-12-26</div> <div ...
I have been attempting to automate the process of accessing a website using Python, but the catch is that it only works when accessed from India. Unfortunately, my current code isn't getting the job done. The existing code, complete with the website link, ...
I'm currently puzzled by the concept of an LSTM layer having a specific number of cells, like 50 in this example. Let's analyze the following LSTM block excerpted from a fascinating blog post: https://i.stack.imgur.com/y91nY.png Assuming my inp ...
Exploring methods to search for a string in a text file using Python, what is the most efficient approach? (considering speed and resource utilization) My initial attempt was as follows. file = open('/home/socfw/src/edl/outbound_monthly.txt') inputIP = ...
As I attempt to gather data from a particular website, I have successfully identified the exact location of the required information. When inspecting the site in Chrome, I can see the specific data I need - in this case, the time. Here is an example of how ...
Within the search results displayed in groups of 7, you can find the address and phone number for each entry on the right side as follows: I need to extract both the address and phone number for each result. The challenge lies in how these elements are st ...
Recently, I acquired a dataset that shows the average temperature change across the entire US, but it is formatted with lat/long range. The original csv file can be found here: original csv I am attempting to convert this data into a raster for visualizat ...
Within an XML file, there are multiple measurements in pixels such as "12px" and "20px". My goal is to reduce all these measurements by half. For example, replacing "12px" with "6px" and so on. Is it possible to accomplish this using regex? In the case of ...
Seeking help with forms and validation in Django using Python. I have a form with a single field where users can input names. However, I need to ensure that only names supported by a third-party website can be entered. Here is my current forms.py: class ...
I'm currently working on my debut Python app which utilizes a word2vec model. Below is the code snippet I have implemented: import gensim, logging import sys import warnings from gensim.models import Word2Vec logging.basicConfig(format='%(ascti ...
Implementing multiple threads to initialize PhantomJS or Chromedriver with the following code: Driver= webdriver.PhantomJS('C:phantomjs.exe',desired_capabilities=dcap, service_args=service_args) or Driver= webdriver.Chrome(executable_path='C:/chromedr ...
I am currently exploring testing Dash applications using the method outlined in this guide: However, I have encountered an issue with specifying the path of Chromedriver for the webdriver-manager used in dash testing. Below is a snippet of what I attempt ...
Recently, I attempted to develop a Bybit Trading bot. However, during testing, it suddenly stopped working and kept displaying the error message (10003) Invalid API key. Despite verifying the accuracy of the API key multiple times, the issue persisted. C ...
I recently developed a straightforward API for Tax Analysis by processing a ZIP file received from our supplier using the FastAPI framework. However, due to some technical constraints, I have now decided to migrate my APIs to Django. I have been exploring ...
def CalculateShortestDistance(maps, i, j, short, k): x = 0 y = 0 for a in range(0, len(maps)): for b in range(0, len(maps[0])): if maps[a][b] == 2: x = a y = b if (i == x) and (j == y): ...
When I open two similar text files on MacVim and read them into Python variables, I notice that their content behaves differently. Can someone explain why this happens and suggest a solution to ensure consistent behavior? Here is an example, where f1.txt ...
I am currently attempting to validate a specific input field, which can be found at the following link: https://groups.google.com/forum/#!topic/webdriver/sUy6IKpQsHw. Although this link is not my own creation, I am interested in validating the text "Please ...
Attempting to retrieve data from a website named: , specifically targeting the element: /html/body/div[1]/div/main/div/div[2]/div/div[2]/div/div/div[1]/div[4]/div[2]/div[1]/div[1]/div[2]/span[2] which displays volume as a number on the webpage. The code I ...
Here is another inquiry regarding computer vision. The concept of a camera matrix, also known as a projection matrix, involves the mapping of a 3D point X from the real world to an image point x in a photograph using the equation: l **x** = P **X** Esse ...
My objective is to compile a list of the names of all newly posted items on within a 24-hour period. After some research, I've discovered that Selenium is the ideal tool for this task as the website I am scraping is dynamic and loads more content as the ...
I am delving into the realm of Python and honing my skills by creating practical applications for daily use. I recently embarked on automating a routine task, but hit a roadblock when attempting to utilize selenium to click on a specific element that dynam ...
In developing a data acquisition device, I am tasked with fetching sensor data from an API every 5 minutes and storing it in CSV files. To reduce the file size, I plan to only save data when there is a change in value. My strategy involves storing all dat ...
I am encountering an issue while attempting to install streamlit on Windows 10 using pip. After the installation of build dependencies, I receive the following error message: C:\Users\Admin\AppData\Local\Temp\pip-install-c7t4b ...
As a Python beginner, I am attempting to insert JSON file data into my database table using Python. However, despite not encountering any errors, I only receive the message: Tweet number 49634 is uploading to the server I'm struggling to identify where t ...
I encountered an issue when trying to assign a freelancer to a specific gig, as the get() method returned more than one Freelancer - in fact, it returned 3! I attempted to retrieve the logged-in freelancer who is creating the gig by using freelancer = get_ ...
With Django, I have managed to successfully retrieve and display data from my model in the content section of the template. However, I am facing issues retrieving data from the model in the header section of the template. Below is the code --> view.py: ...
Looking for instructions on deploying Django 1.5 with FastCGI? I'm struggling to locate the flup package for Python3! ...
Can anyone help me find the username input section on the following website: ? I've included the code snippet I used below: from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import ...
I have extracted a series of elements from an excel datarow: 'Ars','Cr','Assl','Burg','Consp' My goal is to organize them into a nested dictionary as shown below: data_dict.update({'name':'Ars','children':[{ 'name':'Cr','children':[ ...
Having trouble understanding how random.random selects from a list of functions in cmd_advice (assuming that's the correct method)? My debugger is throwing a TypeError: random() takes no arguments (1 given). I'm still learning, so please excuse any mistak ...
I'm having trouble configuring the proxy in my Scrapy project. Every time I try to run it, I encounter the following error: Error 2019-05-09 19:36:50 [scrapy.extensions.telnet] INFO: Telnet console listening on 127.0.0.1:6023 2019-05-09 19:36:50 [scrapy. ...
I am interested in this task: from some_cool_library import fancy_calculation arr = [1,2,3,4,5] for i, item in enumerate(arr): the_rest = arr[:i] + arr[i+1:] print(item, fancy_calculation(the_rest)) [Expected output:] # The fancy results from t ...
When the addmorefield button is clicked on this form, two more fields with the same name are appended: <form method="post" id="sampleform" action="#"> <div class="input_fields" style="text-align:center"> <input type="text" name="first_name ...
I've encountered an issue with my Kivy code where the Float Layout is adding its children from the bottom up instead of top down. I'm trying to figure out how to make it go back to adding items from top down. from kivy.app import App from kivy.l ...
For my Python project, I have decided to use crepe. The module's documentation states that there is a --step-size command available for adjusting the frequency at which pitch analysis is performed. ...
Currently, I am attempting to securely store my SECRET_KEY in an environment variable: # settings/base.py def get_env_variable(var_name): """ Retrieve the environment variable or return an exception """ try: return os.environ[var_name] ...
Recently, I added a new folder to my project in order to utilize methods from files in another project. The process involved adding just the first 3 lines: import sys import os sys.path.insert(0, '/path/to/another/dir') from file_methods import load_obje ...
Why is there a difference in how these two methods establish a connection to the SQL Server? sql_server = 'myserver.database.windows.net' sql_database = 'pv' sql_username = 'sqladmin' sql_password = 'password1' sql_driver= '{ODBC Driver 17 for SQL Serve ...
Currently, I am attempting to perform web scraping on Instagram using Selenium. Specifically, my aim is to log in using the following address with Selenium. On this particular page, the input field for 'username' is structured as shown below: ...
We have encountered a situation where converting a JSON file to parquet results in the creation of numerous small parquet files. How can we prevent this from happening? What is the most effective and efficient approach to managing this transformation? Bel ...
I'm in the process of converting a MATLAB .m source code file to a Python script. The initial lines of the .m file are as follows: clear all close all clc Here is my Python equivalent code for: clear all: def clearall(): """Clear all global variabl ...
I am facing an issue with my Flask app where the form submission process takes a while for the backend to process. In order to prevent users from refreshing or resubmitting, I want to display a loading gif during this time. The current HTML code for my fl ...
Having issues deploying my flask app on Heroku. It runs perfectly fine on my local system, but when deployed and tested on Heroku, I am getting a Response <503>. Sharing the code snippet below import requests import json import time url = 'https ...
After numerous attempts to insert text into an input box that functions as a span element, I decided to seek guidance on the proper approach. In my quest, I turned to utilizing the execute_script() method, but disappointingly, no progress was made. Below ...
I need to transform a dataframe with one row and multiple columns into a new format. Some columns contain single values, while others contain lists of the same length. My goal is to split each list column into separate rows while preserving the non-list co ...
When working with Python, if you have a class named foo, you can use the foo.__module__ method to retrieve a string containing the name of the module it belongs to. Similarly, if you have a module called bar, you can use the bar.__file__ method to obtain ...
Looking to allow a user to input a function name. However, it appears that argparse conducts the type check/conversion prior to checking the choices. Is this a bug? Any recommendations on how to handle this? import argparse def foo(): return 'foo& ...
To verify my code, I can use the following line: print(regressor.predict([[1, 0, 0, 90, 100]])) This will generate an output. The first 3 elements in the array correspond to morning, afternoon, and evening. For example: 1, 0, 0 is considered as morning 0 ...
My current project involves merging two tables: one containing a dataset and the other providing detailed test results based on specific keys from the first table. The data table is as follows: results_items: Test ID | Vehicle ID | Test Class ID | Test R ...
While working on indexing data into Elasticsearch, I encountered a puzzling issue related to the appearance of the ""sort"" attribute. Interestingly, this attribute was not included in my mapping nor in the data being indexed. This instance prom ...
I want to generate an image using PIL and send it through email without the need to save it on the disk. Here's a method that involves saving the image to disk: from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart msg = ...
Looking at the Catalina log provided: oct 21, 2016 12:32:13 AM org.wso2.carbon.identity.sso.agent.saml.SSOAgentHttpSessionListener sessionCreated WARNING: HTTP Session created without LoggedInSessionBean oct 21, 2016 3:03:20 AM com.sun.jersey.spi.containe ...
I'm seeking a way to make the QTextTable within QTextDocument take up 100% or full width of the document. Unfortunately, there doesn't seem to be a method in the QTextTableFormat class that allows for formatting the QTextTable to have 100% width. ...
Is there a suitable equation solver for a timestep scenario? I have tried using ODEint, Solve_ivp, and even sympy to solve a first order differential equation like this: dTsdt = Ts* A - B + C # Defined in a function. This is the mathematical model. wh ...
The Challenge Utilizing Gambit's Python API, I am faced with the task of streamlining a game tree by eliminating strictly dominated strategies. The issue arises when my tree becomes too large for the Gambit UI to handle efficiently and save after tri ...
Currently, I am diving into the world of Flask-SocketIO with a simple chat application in mind. However, I've encountered an issue where messages are not being received by anyone except for the user in the browser. Here's the Python/Flask code sn ...
Issue Looking for a way to generate a list of strings with placeholders (similar to "f-strings") by leveraging the values in a pandas DataFrame. Scenario Consider the following dataframe: import pandas as pd data = [ ['Alice', 13, &apos ...
I am dealing with a Pandas DataFrame that includes the names of Brazilian universities, which can sometimes be listed in both short and long forms (e.g., Universidade Federal do Rio de Janeiro may also appear as UFRJ). Here is an example of how the DataFra ...
Is there a more efficient way to simplify this code by using enumerate instead? list1 = ('c_test1', 'c_test2', 'test3', 'c_test4', 'test5', 'test6', 'c_test7') tuple1 = ['list1', 'list2', 'list3', 'list4'] i = 0 for i, x in enumerate(list(list1)): ...
Can you help me with a Python problem I'm having? I need to split a column into multiple rows, like this: A B ABC|XYZ|PQR 123 And turn it into: A B ABC 123 XYZ ...
I have been working on a web scraping bot using Python and Selenium, but I've encountered an issue. The website I'm trying to scrape has a fieldset HTML tag with 4 label tags inside it. All these labels have the same class name and I need to click on one o ...
I currently have these API endpoints set up: urlpatterns += [ path('api-token-auth/', obtain_jwt_token), path('api-token-verify/', verify_jwt_token), path('api-token-refresh/', refresh_jwt_token), path('api/', include(router.urls)), ] For ...
I'm currently experimenting with lists, the enumerate() method, and CSV files. In my process, I am using the writerows() method to store an enumerate object in a .csv file. However, once the writing is complete, the list/enumerate object ends up empt ...
My Flask application includes login and register routes where I aim to display flash messages when username passwords are not matched. Specifically, this issue arises in my index and login routes: @app.route('/') @login_required def index(): return 'He ...
I am trying to use selenium and Chrome with Python to access a website. Below is a snippet of my code: from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.service import Service # PROXY='h ...
I am seeking to generate all possible combinations of lists with a specific size. For instance, let's consider a list K, where K = [3, 5, 2]. The code snippet below accomplishes this task for the given list. However, I am interested in finding a way to m ...
driver = webdriver.Chrome(driver_path, options=chrome_options) wait = WebDriverWait(driver, 20) driver.get('https://%s/' % asset_id) wait.until(EC.presence_of_element_located((By.XPATH, "//*[@id='dev_diaginfo_fid']"))) prin ...
My Weather Data Extraction Project: I'm currently developing a webpage scraper to collect weather information. This is the progress I have made so far: import urllib.request from bs4 import BeautifulSoup # opening the webpage and storing the content in ...
What is the best way to ensure a command in discord.py can only be used once every minute? @bot.command() async def busk(ctx): member = ctx.message.author.id #gets the user ID, which i use as the _id in pymongo because everyones is different. ...
As part of a D&D game, you find yourself in a battle area with a list of monsters. To enhance your gaming experience, you decide to develop a program that can read and process information about these creatures. You have been provided with an input file na ...
I've been attempting to retrieve the tab name using playwright. However, my code is only displaying the page URL. For instance, I am aiming to visit and extract the name displayed on the browser tab: Rotten Tomatoes: Movies/ Tv Shows/ Movie Trailers... ...
I'm trying to figure out how to plot an image that has been converted into an array using keras.preprocessing.image.img_to_array. Here's my approach. To provide a simple example, I downloaded a picture of a duck from the internet: import urllib.request ...
Hello all, I am looking for assistance in removing the "manyone" option from specific pop up fields, not all of them. Some fields still require this feature, but I have noticed that when using widget="selection", my domain filter stops functioning properly ...
Is there a way to switch between tabs (not windows) using Python Selenium? Here's the scenario: I need to log in to capital.com with Google. The script first clicks on "login", then selects "login with Google", which opens a new tab where I have to ...
Showing my dataset: df = [{'id': 1, 'name': 'bob', 'apple': 45, 'grape': 10, 'rate':0}, {'id': 1, 'name': 'bob', 'apple': 45, 'grape': 20, ...