SharedPreferences prefs = getSharedPreferences("TOKEN_PREF", MODE_PRIVATE);
String token = prefs.getString("token", "");
FirebaseApp.initializeApp(MainActivity.this);
FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>()
{
@Override
public void onComplete(@NonNull Task<InstanceIdResult> task)
{
if(task.isSuccessful())
{
String genToken = task.getResult().getToken();
SharedPreferences.Editor editor = getSharedPreferences("TOKEN_PREF", MODE_PRIVATE).edit();
editor.putString("token", genToken);
editor.apply();
}
else
{
Toast.makeText(MainActivity.this, "Token error : "+task.getException().getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
上面的代码是用户登录帐户时使用的代码,以便我在登录过程中根据用户ID生成令牌并将其存储到数据库中。
答案 0 :(得分:0)
实施此方法并检查
import pandas as pd
df = pd.DataFrame(base_list, columns=['col1', ...])
df.set_index('col1', inplace=True)//Set Col1 as your index
df.dropna(how='all')//or you can use how='any' depending on your need