Skip to content
Advertisement

Tag: dataframe

Find colums that contains lists

I have a huge pandas dataframe 150000 x 330 and I well find columns that have lists [] I have tried but it only returns column names. Answer You can try: Demo You can also find the list of columns with list as follows: Output:

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 then sum that within group to see how many Places ==

reduce() to merge if there are blank DataFrame

I want to use reduce() function to merge data. However, sometimes some dataframe df1 to df8 might be blank (but there is at least one dataframe not be blank). And I do not want to detect which one. For example, this time df1 to df7 are blank and only df8 is non-blank. Next time df1, df2, df5 are non-blank. How

How to sort aggregated numpy array?

My first post on stackoverflow + am very new to programming. Apologies in advance for any poor formatting and missing information. :) I aggregated two columns in a csv file (one column of seller names, the other of transactional amounts) to find how much each seller has made in total: I want to sort it in descending order to find

How can I get unique values from csv?

I have a small question. How can I print all the texts belonging to that author by selecting the author from the csv that I read with the pandas below, can you help with the python code? (ex. I want to display all texts where eap is author.) Thank you! Answer Hey try out using loc() to get back the

Advertisement