Skip to content

Python pandas replace based on partial match with list item

I have a large three-column dataframe of this form: And a long list with entries like this: I want to replace the entries in the Shaperef column of the df with a value from the list if the full Shaperef string matches any part of any list item. If there is no match, the entry is not changed. Desired output:

multiprocessing with moviepy

Recently I made a script that take a 5 minutes video clip and cuts for 5 video, 1 min each video, it works well, but its taking too long for pc like my, and my pc with very good part performance: Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz, 2904 Mhz, 8 Core(s), 16 Logical Processor(s) Installed Physical Memory (…

Buttons in Auto Py to Exe aren’t clickable

I heard about the tool “auto-py-to-exe” but when i open it with the window opens but the language box is empty and no button is clickable. I tried to reinstall it but the error is happening every time and I don’t know why. Is it because i use Chrome or something like that? Maybe you can help…

Using groupby and querying that group

I have a dataframe that I would like to group by one column (dadate) and then query another column (Place) to count only those with the value 1. The above is what I have tired with the error “‘DataFrameGroupBy’ object has no attribute ‘query’” Answer Create the Boolean Series the…

Python Rank with non numeric columns

I’m trying to find a way to do nested ranking (row number) in python that is equivalent to the following in TSQL: I have a table thank looks like this: Looking for Python equivalent to: The output to be: I’ve tried to use rank() and groupby() but I keep running into a problem of No numeric types t…