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
| #!/bin/bash -x | |
| #Date: 21/7/2017 | |
| #Author: Mohan | |
| #Purpose: To upload files to AWS S3 via Curl | |
| #Uploads file at the top level folder by default | |
| #S3 parameters | |
| S3KEY="XXXXXXXXXXX" | |
| S3SECRET="XXXXXXXXXXXXXXXX" |
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
| # The solution for usual problems of opening files with specific encoding, french, englis,arabic .... | |
| def openHoweverFile(filename): | |
| f = None | |
| try: | |
| f = open(filename, 'r', encoding='utf-8') | |
| except UnicodeDecodeError: | |
| f = open(filename, 'r', encoding='windows-1252') | |
| return f |
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
| # Author: Nasreddine DAIFALLAH | |
| # Mail: n_daifallah@esi.dz | |
| # This piece of code helps us to select rows in pandas dataframes using bitwise operations, | |
| # personnnaly it helped me when I wanted to select rows which contain "Ingredients" OR "ingredients | |
| # returns an array contains values of (Array AND Array) | |
| def andArray(a=[], b=[]): | |
| if len(a) != len(b): |
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
| # I needed this in some unprepared datasets | |
| # Author Nasreddine DAIFALLAH | |
| import pandas as pn | |
| class TagLabelEncoder: | |
| def __init__(self, strip=',', tolower=True): | |
| self.strip = strip | |
| self.tolower = tolower | |
| pass |