formatting

Python selenium string formatting in web element

Python selenium string formatting in web element Question: How do I iterate over multiple div web elements? I want to collect EPA Registration numbers (ex: 12455-61, 12455-61-3240) using a for loop, but I get error that the web element cannot be located using string formatting. Here’s the HTML: <div class="product"> <div class="mainSection"><p><span class="reportLabel">EPA Registration #:</span> …

Total answers: 2

How do I get my Telegram bot to write in monospace?

How do I get my Telegram bot to write in monospace? Question: I am trying to write something in "monospace" with my telegram bot using the following Python function: @bot.message_handler(commands=[‘test_monospace’]) def test_monospace(message): bot.reply_to(message, "“`This message should be in monospace“`") Unfortunately, when I test the bot I get the message without the monospace formatting How can …

Total answers: 1

How to efficiently read a GLB file in Python 3.11.1 and extract formatted triangle data?

How to efficiently read a GLB file in Python 3.11.1 and extract formatted triangle data? Question: What I need How to efficiently extract formatted triangle data from the GLB file in this data type: triangles = [triangle1,triangle2,…] triangle = [x1,y1,z1,x2,y2,z2,x3,y3,z3] (1,2,3 – points, values – their coords, x,y,z – dimensions) Here is example of the …

Total answers: 1

How to format different data types to a dd/mm/yyyy format in Python

How to format different data types to a dd/mm/yyyy format in Python Question: I have an code that I want to change all the date column to a format of dd/mm/yyyy. All the values passed in the date column are already in this kind of format, even the second value: 01/02/2001, where I want to …

Total answers: 1

replace characters in a json file

replace characters in a json file Question: I’ve done some wrong manipulation of a 100 json files. Not sure what happened, but most of my json files now have a random number of the last characters repeated (as per image below). Is there a way to clean a json file by deleting characters starting from …

Total answers: 1

Unsupported operand type on Time series management

Unsupported operand type on Time series management Question: Today, I will to manage my time series dataset for using the library TSfresh and make time series classification. I use this tutorial, to adapt the code to my data. For now, I realize some steps, but one error occurs in the splitting data : import os …

Total answers: 2

Python: How do I print a float with a configurable number of decimals

Python: How do I print a float with a configurable number of decimals Question: I want to print some numbers and easily configure how many decimals are displayed. How do I turn something like this: import numpy as np x, y, z, s = np.random.random(4) str_out = ‘[%0.4f,t%0.4f,t%0.4f,t%0.4f]’ % (x, y, z, s) print(str_out) and …

Total answers: 3

from dataframe to the body of Email automatically,several formatting issues: thousand separator, color(red for negative number and green for positive)

from dataframe to the body of Email automatically,several formatting issues: thousand separator, color(red for negative number and green for positive) Question: I have a dataframe look like this date value value 2 daily value change shortCode TD1 2023-01-06 38.67 15162.0 -1.00 TD2 2023-01-06 53.42 33952.0 -0.40 TD3C 2023-01-06 52.91 30486.0 -0.36 TD6 2023-01-06 169.61 90824.0 …

Total answers: 1

clear validated cells using a batch update using pygsheets

clear validated cells using a batch update using pygsheets Question: I have a pygsheets work sheet with cells that have been filled in and would like to clear the cells after pulling the data into python. My issue is that I have validated the cells with a particular data format then when I try to …

Total answers: 1

Plotly – set decimal place in choropleth

Plotly – set decimal place in choropleth Question: How do you convert number 1.425887B to 1.4 in plotly choropleth ? data2022 = dict(type = ‘choropleth’, colorscale = ‘agsunset’, reversescale = True, locations = df[‘Country/Territory’], locationmode = ‘country names’, z = df[‘2022 Population’], text = df[‘CCA3’ ], marker = dict(line = dict(color = ‘rgb(12, 12, 12)’, …

Total answers: 2