Skip to content

Tag: pandas

Pandas look for substring then write in another

So I’m trying to look down a specific column of my csv file for a partial string. If that meets a certain condition, it’ll write something else in a different column. For example: The “Percentage” column will always have the same format of “Ninety Five Percent” that is numb…

how to print first name, last name and birthday in python?

I’m trying to print first name, last name and birthday, so how i could do it? Here’s my code: Output should be like this: last_name first_name birthday Cawthorn David 1995-08-01 Answer First add parse_dates to read_csv for datetimes: Then if need filter by minimal birthday and columns in list use …

Problems Removing Duplicated Words from Pandas Row

I am working on an NLP assignment and having some problems removing duplicated strings from a pandas column. The data I am using is tagged, so some of the rows of data were repeated because the same comment could have multiple tags. So what I did was group the data by ID and Comment and aggregated based on ta…

Converting a Dictionary to DataFrame in Python

I have a dictionary of a static structure: I will need to record data a few extra keys deep to the same depth, so somewhat uniform. Example Dictionary: I want a DataFrame of this structure: Example Desired DataFrame: Where all Child Values are either a list object of strings or a string object. From researchi…