I have a python assignment that i have been working on for a while and this last part has had me stumped as i dont know how to go about it. I am supposed to count the number of inputs a column has in order for the rest of my code not to begin again at 1. Here is what the column looks like:
CSV file column that shows similar name
so i currently have this as my code to search and it works perfectly fine and i have been using the pandas library for this entire project. It will pull all the strings that contain the name i inputed (ex. E_LAPALMA). "Terminal" being the name of that column and YRN being the name of the file.
searchcell = input("What would you like to search? ")
var1 = YRN[YRN['Terminal'].str.contains(searchcell)]
if not var1.empty:
print("Matches")
print(var1)
editline()
else:
print("No matches")
How can i count the number at the end of the input i type in and then be able to add +1 to that for new cells i have to input? For ex. the last cell containing E_LAPALMA is E_LAPALMA_03, how can i make the code add my new cell and change the name to E_LAPALMA_04?
If possible, is there a way to edit the numbering the existing cells? For ex. i need to change E_LAPALMA_02 to E_LAPALMA_04.