0

What is the difference between the following 2 lines of code

dict_a=dict.fromkeys(['aaa', 'bbb'], pd.DataFrame()) 

and

dict_b={sheet: pd.DataFrame() for sheet in ['aaa', 'bbb']}

For both lines I can assign different changes to the dataframe of 'aaa' and 'bbb' individually like I want, so what is the difference between the two lines of code?

jonrsharpe
  • 107,083
  • 22
  • 201
  • 376
Pythn
  • 129
  • 9

0 Answers0