Skip to content

Tag: pandas

Matching Two Pandas DataFrames based on values in columns

I’m trying to match job candidates to mentors based on different several variables that would hopefully create a good match. There are two Pandas DataFrames (one for candidates and one for mentors) that I’m trying to connect based on experience, location, desired job, etc. For example I have a men…

Python Read Website Table Data into Dataframe

I came to know this source to import data. I tried but not successful in importing the data https://public.opendatasoft.com/explore/embed/dataset/us-zip-code-latitude-and-longitude/table/ my code: Presently I see no data but a string text. Table on the data: Answer JS is creating the table and rendering of ja…

Grouping and concatening values in Pandas dataframes

I found an answer to my question in another request on this site, however the answer provided doesn’t work for me so I’m asking in a different request. I will use the same data and show results I’m getting. So basically, I have a dataframe that one column has repeated values that I want to g…

Pandas conditional counting by date

I want to count all orders done by each customer at each order date, to find out how many orders were done at the time of each order. Input: Expected output: The following code works but is extremely slow. Taking upwards of 10 hours for 100k+ rows. There is certainly a better way. Answer Try sort_values to ge…

Pandas – Merge rows of dataframe that have a shared value

I have a dataframe with a list of items in the first row and then all the items that were bought with that item in subsequent columns: I want to merge all the items bought with each item into a single row as below: So, all the items bought with Item 1 form the columns next to it. As you