Created
June 8, 2020 08:32
-
-
Save aniruddha27/3d4be25ddfaabddef4aa0b1752cacd9f to your computer and use it in GitHub Desktop.
This file contains 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
# create a dataframe containing sentences | |
df2 = pd.DataFrame(columns=['Sent','Year','Len']) | |
row_list = [] | |
for i in range(len(df)): | |
for sent in df.loc[i,'sent']: | |
wordcount = len(sent.split()) | |
year = df.loc[i,'Year'] | |
dict1 = {'Year':year,'Sent':sent,'Len':wordcount} | |
row_list.append(dict1) | |
df2 = pd.DataFrame(row_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment