Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

group by 2 unique attributes pandas

import numpy as np
g = df.groupby('c')['l1','l2'].apply(lambda x: list(np.unique(x)))
Comment

PREVIOUS NEXT
Code Example
Python :: sum with conditional python 
Python :: how to get input from pyqt line edit 
Python :: how to add extra zeros after decimal in python 
Python :: closing a file in python 
Python :: udp server python 
Python :: python comment 
Python :: replace word in column pandas lambda 
Python :: how to take multiple line input in python 
Python :: django createssuperuser 
Python :: for in python 
Python :: how to change index in dataframe python 
Python :: how to use dictionaries in python 
Python :: plt get colors in range 
Python :: django datepicker 
Python :: enter selenium in python 
Python :: start a django project 
Python :: from django.http import HttpResponse 
Python :: python square a number 
Python :: how to install python pyautogui 
Python :: unique combinations in python 
Python :: remove special characters from string in python 
Python :: python datetime add 
Python :: opencv loop video 
Python :: numpy delete 
Python :: increment python 
Python :: pandas count number of rows with value 
Python :: how to convert csv to excel in python 
Python :: xpath start-with 
Python :: duplicate in list 
Python :: pandas today date 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =