我从API响应中有类似的数据框架:
但是,API可以给出更多变量,例如街道,方向等,因此,我需要从API响应中创建一个输出,该输出自动定义NULL 。如下示例
为此,我创建了我在输出中想要的所有变量的列表,并尝试并匹配API响应数据帧与输出数据帧。
任何帮助将不胜
感激
I have a dataframe like below from an API response:

However, The API can give more variables like street, direction etc., So, I need to create an output from the API response which automatically define null. Example like below

For this I created a list of all the variables I want in the output and tried and match API response dataframe to the output dataframe.
Any help will be greatly appreciated
Thanks in advance
发布评论
评论(1)
iiuc使用 按列表,如果不存在列,则缺少值填充:
IIUC use
DataFrame.reindex
by list, if column not exist is filled by missing values: