2.3 Python数据处理案例讲解
本节主题:2.3 Python数据处理案例讲解
课程讲师:Yunlin
观看地址:点我进入
1 本节要点
- 上期作业讲解
- 简道云数据处理演示
2 课前准备
无
3 课程内容
3.1 上期作业讲解
(演示)
3.2 简道云数据处理演示
a = {
"data": [
{
"creator": {
"_id": "5cecd40dd23e194ab0867aab",
"name": "查理",
"username": "cxt7777"
},
"updater": {
"_id": "5cecd40dd23e194ab0867aab",
"name": "查理",
"username": "cxt7777"
},
"deleter": null,
"createTime": "2020-03-26T02:41:06.491Z",
"updateTime": "2020-03-26T02:46:27.825Z",
"deleteTime": null,
"_widget_1557886562320": "iPhone 11",
"_widget_1557886562335": "5998",
"_widget_1557886562350": "17",
"_id": "5e7c164229e01a00063be284",
"appId": "5e798363b587cc0006b40445",
"entryId": "5cdb765b5a6ae613aeed0f84"
},
{
"creator": {
"_id": "5cecd40dd23e194ab0867aab",
"name": "查理",
"username": "cxt7777"
},
"updater": {
"_id": "5cecd40dd23e194ab0867aab",
"name": "查理",
"username": "cxt7777"
},
"deleter": null,
"createTime": "2020-03-26T02:47:02.037Z",
"updateTime": "2020-03-26T02:47:02.037Z",
"deleteTime": null,
"_widget_1557886562320": "iPhone X",
"_widget_1557886562335": "4998",
"_widget_1557886562350": "5",
"_id": "5e7c17a650bccb0006441778",
"appId": "5e798363b587cc0006b40445",
"entryId": "5cdb765b5a6ae613aeed0f84"
},
{
"creator": {
"_id": "5cecd40dd23e194ab0867aab",
"name": "查理",
"username": "cxt7777"
},
"updater": {
"_id": "5cecd40dd23e194ab0867aab",
"name": "查理",
"username": "cxt7777"
},
"deleter": null,
"createTime": "2020-03-26T02:47:43.059Z",
"updateTime": "2020-03-26T02:47:43.059Z",
"deleteTime": null,
"_widget_1557886562320": "iPhone 8",
"_widget_1557886562335": "3998",
"_widget_1557886562350": "32",
"_id": "5e7c17cfcd87510006cf8189",
"appId": "5e798363b587cc0006b40445",
"entryId": "5cdb765b5a6ae613aeed0f84"
}
]
}
数据结构解析
- 将数据赋值给变量data_iphone后
变量名 | data_iphone |
数据类型 | 字典 |
key数据类型 | 字符串 |
key | ‘data’ |
通过key获取value | data_iphone[‘data’] |
value数据类型 | 列表 |
value | [{‘creator’: {‘_id’: ‘5cecd40dd23e194ab0867aab’, ‘name’: ‘查理’, ‘username’: ‘cxt7777’}, ‘updater’: {‘_id’: ‘5cecd40dd23e194ab0867aab’, ‘name’: ‘查理’, ‘username’: ‘cxt7777’}, ‘deleter’: None, ‘createTime’: ‘2020-03-26T02:41:06.491Z’, ‘updateTime’: ‘2020-03-26T02:46:27.825Z’, ‘deleteTime’: None, ‘_widget_1557886562320’: ‘iPhone 11’, ‘_widget_1557886562335’: ‘5998’, ‘_widget_1557886562350’: ‘17’, ‘_id’: ‘5e7c164229e01a00063be284’, ‘appId’: ‘5e798363b587cc0006b40445’, ‘entryId’: ‘5cdb765b5a6ae613aeed0f84’}, {‘creator’: {‘_id’: ‘5cecd40dd23e194ab0867aab’, ‘name’: ‘查理’, ‘username’: ‘cxt7777’}, ‘updater’: {‘_id’: ‘5cecd40dd23e194ab0867aab’, ‘name’: ‘查理’, ‘username’: ‘cxt7777’}, ‘deleter’: None, ‘createTime’: ‘2020-03-26T02:47:02.037Z’, ‘updateTime’: ‘2020-03-26T02:47:02.037Z’, ‘deleteTime’: None, ‘_widget_1557886562320’: ‘iPhone X’, ‘_widget_1557886562335’: ‘4998’, ‘_widget_1557886562350’: ‘5’, ‘_id’: ‘5e7c17a650bccb0006441778’, ‘appId’: ‘5e798363b587cc0006b40445’, ‘entryId’: ‘5cdb765b5a6ae613aeed0f84’}, {‘creator’: {‘_id’: ‘5cecd40dd23e194ab0867aab’, ‘name’: ‘查理’, ‘username’: ‘cxt7777’}, ‘updater’: {‘_id’: ‘5cecd40dd23e194ab0867aab’, ‘name’: ‘查理’, ‘username’: ‘cxt7777’}, ‘deleter’: None, ‘createTime’: ‘2020-03-26T02:47:43.059Z’, ‘updateTime’: ‘2020-03-26T02:47:43.059Z’, ‘deleteTime’: None, ‘_widget_1557886562320’: ‘iPhone 8’, ‘_widget_1557886562335’: ‘3998’, ‘_widget_1557886562350’: ‘32’, ‘_id’: ‘5e7c17cfcd87510006cf8189’, ‘appId’: ‘5e798363b587cc0006b40445’, ‘entryId’: ‘5cdb765b5a6ae613aeed0f84’}] |
- data_iphone的value解析
变量名 | data_iphone[‘data’] |
数据类型 | 列表 |
获取列表中第一个数据 | data_iphone[‘data’][0] |
列表中第一个数据的值 | {‘creator’: {‘_id’: ‘5cecd40dd23e194ab0867aab’, ‘name’: ‘查理’, ‘username’: ‘cxt7777’}, ‘updater’: {‘_id’: ‘5cecd40dd23e194ab0867aab’, ‘name’: ‘查理’, ‘username’: ‘cxt7777’}, ‘deleter’: None, ‘createTime’: ‘2020-03-26T02:41:06.491Z’, ‘updateTime’: ‘2020-03-26T02:46:27.825Z’, ‘deleteTime’: None, ‘_widget_1557886562320’: ‘iPhone 11’, ‘_widget_1557886562335’: ‘5998’, ‘_widget_1557886562350’: ‘17’, ‘_id’: ‘5e7c164229e01a00063be284’, ‘appId’: ‘5e798363b587cc0006b40445’, ‘entryId’: ‘5cdb765b5a6ae613aeed0f84’} |
列表中第一个数据的数据类型 | 字典 |
列表中第一个数据中的key为’_widget_1557886562320’的value | data_iphone[‘data’][0][‘_widget_1557886562320’] |