Good alternative to Pandas .append() method, now that it is being deprecated?

Create a list with your dictionaries, if they are needed, and then create a new dataframe with df = pd.DataFrame.from_records(your_list). List’s “append” method are very efficient and won’t be ever deprecated. Dataframes on the other hand, frequently have to be recreated and all data copied over on appends, due to their design – that is … Read more

Strip white spaces from CSV file

There’s also the embedded formatting parameter: skipinitialspace (the default is false) http://docs.python.org/2/library/csv.html#csv-fmt-params aList=[] with open(self.filename, ‘r’) as f: reader = csv.reader(f, skipinitialspace=False,delimiter=”,”, quoting=csv.QUOTE_NONE) for row in reader: aList.append(row) return(aList)

How to convert a python datetime.datetime to excel serial date number

It appears that the Excel “serial date” format is actually the number of days since 1900-01-00, with a fractional component that’s a fraction of a day, based on http://www.cpearson.com/excel/datetime.htm. (I guess that date should actually be considered 1899-12-31, since there’s no such thing as a 0th day of a month) So, it seems like it … Read more