I have a scenario where I am running two functions in a script:
test.py :
def func1():
df1=pd.read_csv('test1.csv')
val1=df['col1'].mean().round(2)
return va11
def func2():
df2=pd.read_csv('test2.csv')
val2=df['col1'].mean().round(2)
return val2
def func3():
dataf = pd.read_csv('test3.csv')
col1=dataf['area']
col2 = dataf['overall']
dataf['overall']=val1 # value from val1 ->leads to error
dataf['overall']=val2 #value from val2 ->leads to error
Here I am reading test1.csv & test2.csv file and I am storing the mean value in variable "val1" & "val2" respectively and returning the same. These variable values I want to store in a new test3.csv file which is having two cols and values should be stored one after one(appending). By the above it is not working out & couldn't find anything on internet as such. Any help would be great.