Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. This post was edited and submitted for review 7 months ago and failed to reopen the post: Original close reason(s) w…
Tag: python
select first occurrence where column value is greater than x for each A(key) | dataframe
What I have What I want, select first occurrence where D >= 4 for each A(key) So end result will look like, Answer You can first slice the rows that match the condition on D, then groupby A and get the first element of each group: output:
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…
Is it possible to optimize hyperparameters for optional sklearn pipeline steps?
I tried to construct a pipeline that has some optional steps. However, I would like to optimize hyperparameters for those steps as I want to get the best option between not using them and using them with different configurations (in my case SelectFromModel – sfm). The error that I get is ‘string&#…
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…
Python fix french accents parsed as =C3=A9
In python i’m stuck with a couple of strings from french language with accents that I can’t convert back to normal, e.g.: Most documentation I read specify to read the files with some encodings=’utf-8′ or so, but here I’m stuck with actual strings. Is there a way to decode the st…
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 …