Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Views: 18654
Kernel: Python 3

Edit or detete participant fields

Notebook used to do batch edits or deletions of participant's fields

#%load_ext autoreload %autoreload from oss_hugo.OSS_Participant import OSS_Participant from oss_hugo.API_Hugo_OSS import API_Hugo_OSS from oss_hugo.OSS_GSheet_Data import OSS_GSheet_Data
fields_to_delete = ['night_day','eventbrite_id','funded_who','night_room','regonline','pre-summit', 'sponsored_by','venue','villa'] hugo.df_participants()[fields_to_delete].tail()
night_day eventbrite_id funded_who night_room regonline pre-summit sponsored_by venue villa
122 NaN None NaN NaN NaN NaN NaN NaN NaN
123 NaN None NaN NaN NaN NaN NaN NaN NaN
124 NaN None NaN NaN NaN NaN NaN NaN NaN
125 NaN None NaN NaN NaN NaN NaN NaN NaN
126 NaN None NaN NaN NaN NaN NaN NaN NaN
#Deleting multiple fields %autoreload fields_to_delete = ['night_day','eventbrite_id','funded_who','night_room','regonline','pre-summit', 'sponsored_by','venue','villa'] md_participants = hugo.md_files_participants() for md_participant in md_participants: participant = OSS_Participant(md_participant) for field_to_delete in fields_to_delete: participant.delete_field(field_to_delete) participant.save() "removed {0} fields from {1} files".format(len(fields_to_delete), len(md_participants))
'removed 9 fields from 126 files'
#deleting email field from oss_hugo.OSS_Participant import OSS_Participant md_participants = hugo.md_files_participants() for md_participant in md_participants: participant = OSS_Participant(md_participant) participant.delete_field('email', auto_save=True) "all done" #check change in git
'all done'
hugo.df_participants().columns
Index(['chapter_leader', 'company', 'email', 'facebook', 'featured', 'image', 'job_title', 'layout', 'linkedin', 'night_where', 'notes', 'pre_summit', 'project_leader', 'role', 'sessions', 'status', 'title', 'tracks', 'travel-from', 'travel_from', 'twitter', 'type', 'website', 'working_sessions'], dtype='object')
#hugo.df_participants()[['title','chapter_leader']]
gsheet=OSS_GSheet_Data()
df_gsheet = gsheet.df_participants_onsite()
#df_gsheet[df_gsheet['Chapter Leader'] != '']
#df_gsheet[df_gsheet['Project Leader'] != '']