I'd like to use a dataframe in function_B
which is produced by function_A
def function_A():
df = pandas.DataFrame(data,columns=['A'])
return df
def function_B():
df1 = function_A()
if __name__ == '__main__':
function_A()
function_B()
However, df1
and df
got difference.
df
is like
A
0 aaa
1 bbb
And df1
is an EMPTY dataframe. Anyone knows the reason of it?
EDIT
I want to concatenate df1
with another dataframe in funtion_B
.
def function_B():
df1 = function_A()
df2 = pandas.DataFrame(data2,columns=['A'])
pandas.concat([df1,df2])
Is there any other solutions except return df1
which was referred by most of the answers.