I have a dataframe of data that I am trying to add to another frame. I tried various ways with .append (), and there was no successful way. When I print data from iterrows. I provide 2 possible ways to try to solve the problem below, one creates an error, the other does not fill the dataframe with anything.
The workflow I'm trying to create is to create a framework based on a file that contains the transaction history of customer orders. I just want to create a separate order entry, and I'm going to add different logic to update order details based on updates in history. At the end of the script, it will have one record for all orders and the final state of these orders after iteration through the history file.
class om(): """Manages over the current state of orders""" def __init__(self,dataF, desc='NONE'): self.df = pd.DataFrame self.data = dataF print type(dataF) self.oD= self.df(data=None,columns=desc) def add_data(self,df): for i, row in self.data.iterrows(): print 'row '+str(row) print type(row) df.append(self.data[i], ignore_index =True) """ This line creates and error""" df.append(row, ignore_index =True) """This line doesn't append anything to the dataframe.""" test = order_manager(body,header) test.add_data(test.orderData)
Chris source share