Oct-02-2018, 03:38 PM
After receiving some feedback on past posts, I have begun re-designing my code to be more object oriented. It's going great and is really fun finding the best ways to fit all the pieces, but I have come across an issue that is a nuisance, but not detrimental. I have a function that creates a 'description' for the data frame. The description is comprised of 4 sections:
Date
Item
Name
SaleID
The sections are then concatenated and inserted into the InvoiceDataFrame.
The arguments that this function calls for are plenty due to needing a variety of information to create and merge the description into the main data frame. The arguments consists of:
Date
Vin
Item
SaleID
CurHA
CC
The reason I've posted this is because the entire code looks like I could somehow consolidate/compress it more. I feel I shouldn't have to use so many break lines? Here is what it looks like with what I've described above. I will go ahead and point out that I am sure there will be other critiques of the code and if that is the case, please do give me your feedback! Thank you.
Date
Item
Name
SaleID
The sections are then concatenated and inserted into the InvoiceDataFrame.
The arguments that this function calls for are plenty due to needing a variety of information to create and merge the description into the main data frame. The arguments consists of:
Date
Vin
Item
SaleID
CurHA
CC
The reason I've posted this is because the entire code looks like I could somehow consolidate/compress it more. I feel I shouldn't have to use so many break lines? Here is what it looks like with what I've described above. I will go ahead and point out that I am sure there will be other critiques of the code and if that is the case, please do give me your feedback! Thank you.
InvoiceDataFrame.loc[InvoiceDataFrame.index[len(InvoiceDataFrame) - 1], InvoiceDataFrame.columns[2]] = CreateDescription(Date=LoadedSales['LOGDATE'][inx], Vin=CustomerVin, Item=FindItem(Item=LoadedSales['NAME'][inx], SaleID=LoadedSales['SALEID'][inx]), SaleID=LoadedSales['SALEID'][inx], CurHA=HouseAccount, CC=CC)And here is the header of the function CreateDescrition():
def CreateDescription(Date, CC, Item, SaleID, CurHA, Vin):