Hi,
I want to read a CSV file and I defined one function class, but my program gives error.
my input csv file to read:
TypeError: read_data() missing 1 required positional argument: 'mode'
I want to read a CSV file and I defined one function class, but my program gives error.
my input csv file to read:
col1 col2 col3 A 2 45 C 21 71 V 63 9 M 45 0I use the below code:
logging.basicConfig(filename='temp_log.txt', level=logging.DEBUG)
logging.debug("Hello new log")
colName=['col1','col2']
logging.debug("Initialize file read...")
def read_data(self, inFile, colNames,mode):
try:
df_tmp= pd.read_csv(inFile)
self.mode=mode
self.colNames=colNames
print(mode)
print(colName)
df=df_tmp.loc[df_tmp[colNames]]
logging.debug("Read data successfully")
print(df.head)
except OSError as e:
logging.debug("File read fail check fail reason below")
logging.debug(e.errno)
data =read_data(r'D:\PythonCodes\inFile.csv','col1', 'NOM') error:TypeError: read_data() missing 1 required positional argument: 'mode'
