{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercise 6 - XML"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1 Add the necessary libraries (xml and pandas)."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"2 Save the XML structure shown below as a string in a variable. In addition, load the content from the file *users_first.xml* into another variable."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"#
[{\n",
" 'type': 'customer',\n",
" 'name': 'Morgan Sykes',\n",
" 'phone': '1-183-546-6564',\n",
" 'email': 'lorem.auctor@vulputatemauris.net',\n",
" 'streetaddress' : '2594 Tellus St.',\n",
" 'country': 'Russian Federation',\n",
" 'postalZip': '584585'\n",
"}]\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"4 Convert both lists into dataframes and finally combine them into one dataframe (remember to reset the index of the new dataframe!). Print the content of the generated dataframe."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"#"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"5 Some users are missing a phone number. Print the number of these users."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"#"
]
}
],
"metadata": {
"interpreter": {
"hash": "8b50b686190c14b0a5176f7257ee24c43a886d1ffbaa1fefb478a1f90f0f3afb"
},
"kernelspec": {
"display_name": "Python 3.8.8 64-bit ('base': conda)",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}