I have a dataframe of data that I am trying to append to another dataframe. I have tried various ways with .append() and there has been no successful way. When I print the data from iterrows, I provide 2 ways I tried to solve the issue below: one creates an error, the other doesn't populate the dataframe with anything.
The workflow I am trying to create is create a dataframe based off of a file that contains transaction history of customer orders. I only want to create a single record per order and I am going to add other logic to update the order details based on updates in the history. By the end of the script, it will have a single record for all of the orders and the end state of those orders after iterating through the history file.
class order_manager():
"""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)
pd.concat([df1, df2]). No need to iteratively append one line at a time.append?appendis deprecated in favor ofconcat