Background Not a programmer, and using Python to develop engineering tools and analyze data, so a little bit like Matlab.
Context and objective After the terrible news of Mint shuttind down, I want to build a little personnal finance and budget Python script. I have years of transactions data stored in a csv file. What I would like is, using Spyder, to load the csv in a pandas dataframe, pause the code with for instance the input() function, modify elements in the dataframe using the variable explorer, and resume the script which would end with a save of the newly modified dataframe as a csv that would overwrite the original one that was read at the start of the programe.
Question Is there a way for variables to appears in Spyder's variable explorer and be able to modify such variables using the variable explorer while the code is paused using input() or any other function?
Example So let's consider a csv file in a local Windows folder with 3 columns, 1st column is date, second column is transaction amnount and 3rd column is transaction category. Looking at the script below, the idea is to read and store the transaction data from the csv file in a dataframe, have it appear in the variable explorer when the code is paused with for instance the input() function, use Spyder's variable explorer's interactive nature to modify some elements in the dataframe (e.g. change the wording of the category of a transaction), and resume the code so that the modified dataframe can be saved as a csv and overwrite the initial csv file. By default, variables do not appear in the variable explorer until the script has ended.
import numpy as np
import pandas as pd
import os
df = pd.read_csv('somefile.csv')
input("Press ENTER to resume")
# Perform modifications to df elements in Spyder variable explorer and then resume script by pressing enter
df.to_csv('somefile.csv', index=False)