something within these lines
As a side note - do you really think it's a good idea to hardcode the base_path and the csv file name? why not pass the full path to read_data method instead?
import pandas as pd import os class PythonTraining(): def read_data(self, filepath): base_path = "D:\Data" full_filepath = os.path.join(base_ath, filepath, "outsummary.csv") self.data = pd.read_csv(full_filepath) x = PythonTraining() x.read_data("PythonCodes") print(x.data.head())the other options is read_data() to return the dataframe and you to assign it to a name.
As a side note - do you really think it's a good idea to hardcode the base_path and the csv file name? why not pass the full path to read_data method instead?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs