I have a function that changes values of my csv file with edits in it and with a method, but i think that the since the main function used df = pd.read_csv() before the method, it's to_csv would only set the file to the original with the changes made minus the methods changes to it since df wouldn't include the changes from the method.
df = pd.csv('/Users/Bramblestar/FBot/factions.csv', index_col=0) setFacVal(gId, cId, 2, value) df[str(gId)][row] = value2 df.to_csv('/Users/Bramblestar/FBot/factions.csv') def setFacVal(gId, cId, fType, fValue): #0name 1points 2description 3color 4role 5opRole df = pd.read_csv('/Users/Bramblestar/FBot/factions.csv', index_col=0) df.iloc[fType, list(df.keys()).index(str(gId))] = fValue df.to_csv('/Users/Bramblestar/FBot/factions.csv') Is there a pd.read_csv parameter that gives me only the part that i want to edit? or a way to use to_csv in a way that it only replaces part of the file with the edited one from the copy?
https://stackoverflow.com/questions/66701092/how-do-i-edit-parts-of-my-csv-file-at-a-time March 19, 2021 at 08:42AM
没有评论:
发表评论