Try this,i see your
username
in not just a string but a variable that get as argument from function. user_df = pd.DataFrame(credentials[username], index=[0])Basic test to see if this work.
import pandas as pd credentials = dict() credentials['username'] = {"password" : 123, "email" : 'test@org', "phone_number" : 55667788, "notes" : 'hei'} user_df = pd.DataFrame(credentials['username'], index=[0]) print(user_df)
Output: password email phone_number notes
0 123 test@org 55667788 hei