Last active
May 20, 2021 04:41
-
-
Save Dhrumilcse/1684c0dbace7b93db1044bb8680d2ec3 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
#Event handler for upload button | |
def upload_btn_eventhandler(obj): | |
#Clear output before each run | |
with data_process_output: | |
clear_output() | |
#Read file | |
for file_name in upload_file.value: | |
#Split file name to extract data | |
extension = file_name.split('.')[1] | |
content = upload_file.value[file_name]['content'] | |
if(extension == 'xlsx' or extension == 'xls'): | |
data = pd.read_excel(BytesIO(content)) | |
elif(extension == 'csv'): | |
data = pd.read_csv(BytesIO(content)) | |
else: | |
print("File not accepted") | |
# Calling another function to filter data (next step) | |
# filter_data(data) | |
return data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment