I have a lot of dataframe that have similar names for example:
NB_2014= pd.read_csv("E:/NB_2014.CSV", sep=';', thousands='.', decimal=',')
NB_2015= pd.read_csv("E:/NB_2015.CSV", sep=';', thousands='.', decimal=',')
NB_2016= pd.read_csv("E:/NB_2016.CSV", sep=';', thousands='.', decimal=',')
NB_2017= pd.read_csv("E:/NB_2017.CSV", sep=';', thousands='.', decimal=',')
NB_2018= pd.read_csv("E:/NB_2018.CSV", sep=';', thousands='.', decimal=',')
and so on. I was wandering if there is a way to call the right dataframe just by having the year that I need, for example I tried:
year_needed = 2018
print("NB_"+str(year_needed)["col_needed"])
but I get the following error:
TypeError: string indices must be integers
Is there a way to access the dataframe just by having a piece of its name?
Thanks in advance!