Oct-04-2018, 05:11 PM
I read by accident, somewhere online, recently that it is highly unsought to append/insert a data frame either row by row, or cell by cell (for iloc). I cannot recall which one exactly, but to the point; What is the best way to append data into a data frame? Here is the snippit I have. I am doing my best to work with PEP8 style guide while making changes at the same time so feel free to mention discrepancies in the style. I have a total of 12 columns and I feel that appending each line singly is not good to do. It looks too separated (for lack of better words to explain it).
# Sets the quantity # InvoiceDataFrame.loc[[len(InvoiceDataFrame) - 1], InvoiceDataFrame.columns[3]]="1" # Sets the class # InvoiceDataFrame.loc[[len(InvoiceDataFrame) - 1], InvoiceDataFrame.columns[4]]=ClassIndex[LoadedSales.iloc[inx, 1]] # Sets the Job name # InvoiceDataFrame.loc[[len(InvoiceDataFrame) - 1], InvoiceDataFrame.columns[5]]=HA # Sets the Terms # InvoiceDataFrame.loc[[len(InvoiceDataFrame) - 1], InvoiceDataFrame.columns[6]]="Redacted"Note: With regards to PEP8 Style Guide. I haven't taken time yet to change my variable names to match the style guide.