Created
July 13, 2015 16:14
-
-
Save retrography/3cfd65f3f075de5b0373 to your computer and use it in GitHub Desktop.
GROUP BY for strings in Python Pandas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pandas import DataFrame as df | |
import pandas as pd | |
lics = pd.read_csv("/Users/Mah/Temp/csvdb/license-union-norownum.csv") | |
licsgr = lics.groupby('gem')['license'].apply(list) | |
licsgr.columns = ['gem', 'licenses'] | |
# But how do we convert Series to DataFrame in Pandas? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment