Created
June 5, 2020 21:11
-
-
Save aniruddha27/73ed6c9e90ac24c2fcfe2bf170d77d9e 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
row_list = [] | |
# df2 contains all sentences from all speeches | |
for i in range(len(df2)): | |
sent = df2.loc[i,'Sent'] | |
if (',' not in sent) and (len(sent.split()) <= 15): | |
year = df2.loc[i,'Year'] | |
length = len(sent.split()) | |
dict1 = {'Year':year,'Sent':sent,'Len':length} | |
row_list.append(dict1) | |
# df with shorter sentences | |
df3 = pd.DataFrame(columns=['Year','Sent',"Len"]) | |
df3 = pd.DataFrame(row_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment