Skip to content

Tag: python

Explode a column with multiple values separated by comma

How are you? I have a database where some lines have more than one product and they are separated by a comma, as in the example below (there are other columns, but to make it more practical I only took these three). id produdct value 47 product1, product 2 12000.0 48 product3 48000.0 49 product4, product1, pr…

Extract parameters from variable length python f-string

Using Python 3.6 I have an f-string in main that looks like used in the following function call send_mail(title, message, to, from) I am not allowed to change the function call. The question is, inside send_email can I extract the folder, and host variables from the f-string? I would normally try something li…

sqlite3.OperationalError:: syntax error when trying to UPDATE

I have been trying to update some values in a sqlite3 table but I am having loads of problems with the `sqlite3.OperationalError: near “GROUP”: syntax error. I have been following the documentation but I am not been very successful to correct the error. What I am trying to do is to find the all_nu…

passing table name to pipeline scrapy python

I have different spiders that scrape similar values and I want to store the scraped values in different slite3 tables. I can do this by using a different pipeline for each spider but, since the only thing that changes is the table name, would it be possible to pass somehow the table name from the spider to th…

Python array as a counter

I’m a Python 3.0 beginner and I’m struggling to find a solution to the following problem. It’s a step for a Galton Board simulation exercise. I have an numpy array, which length is auto generated based on another variable I am then generating a set of numbers, adding them to a list and summi…

How to convert Web PDF to Text

I want to convert web PDF’s such as – https://archives.nseindia.com/corporate/ICRA_26012022091856_BSER3026012022.pdf & many more into a Text without saving them into my PC ,Cause 1000’s of such announcemennts come up daily , Hence wanted to convert them to text without saving them on my …