I am trying to understand in principle how Python "thinks". Maybe someone can explain and inlighten me:
If I read two data sets into one pandas dataframe each, for example:
import pandas as pd
df1 = pd.read_csv('data1.csv')
df2 = pd.read_csv('data2.csv')
How does Python know which one of the two dataframes I want to actually use?
How does the internal mapping work?
I am able to call the both dataframes with df1
and df2
and do calculations or chose subsets of them but I am not able to do something like
print(df1.name)
as no name is explicitly given. Why?
Can I access somehow the identifyer ('df1' or 'df2') of the dataframes like a string variable? How does Python establish the link between my call and the correct memory location?
Or can I pass the identifyer to a string variable without explicitly assigning a name to the two dataframes with
df1.name = 'df1'
and
df2.name = 'df2'
?
Thanks for helping me understand.