diff --git a/data/bible_with_verse_text.csv b/data/bible_with_verse_text.csv
new file mode 100644
index 0000000..1a54695
--- /dev/null
+++ b/data/bible_with_verse_text.csv
@@ -0,0 +1,28 @@
+Name,Role,Book,Chapter,Verse,Text
+Adam,First Man,Genesis,1,1,"In the beginning, God created the heavens and the earth."
+Eve,First Woman,Genesis,22,5,"Abraham said to his young men, “Stay here with the donkey. The boy and I will go yonder. We will worship, and come back to you.”"
+Noah,Builder of the Ark,Genesis,12,10,"There was a famine in the land. Abram went down into Egypt to live as a foreigner there, for the famine was severe in the land."
+Abraham,Father of Nations,Genesis,6,15,"This is how you shall make it. The length of the ship shall be three hundred cubits, its width fifty cubits, and its height thirty cubits."
+Sarah,Wife of Abraham,Genesis,28,2,"Arise, go to Paddan Aram, to the house of Bethuel your mother’s father. Take a wife from there from the daughters of Laban, your mother’s brother."
+Moses,Leader of the Exodus,Exodus,2,3,"When she could no longer hide him, she took a papyrus basket for him, and coated it with tar and with pitch. She put the child in it, and laid it in the reeds by the river’s bank."
+Aaron,Brother of Moses,Exodus,13,8,"You shall tell your son in that day, saying, ‘It is because of that which Yahweh did for me when I came out of Egypt.’"
+David,King of Israel,1 Samuel,8,4,Then all the elders of Israel gathered themselves together and came to Samuel to Ramah.
+Solomon,Wisest Man,Proverbs,12,9,"Better is he who is little know, and has a servant,
+than he who honors himself, and lacks bread."
+Isaiah,Prophet,Isaiah,4,6,"There will be a pavilion for a shade in the daytime from the heat, and for a refuge and for a shelter from storm and from rain."
+Jeremiah,Prophet,Jeremiah,3,16,"It will come to pass, when you are multiplied and increased in the land, in those days,” says Yahweh, “they will no longer say, ‘the ark of Yahweh’s covenant!’ It will not come to mind. They won’t remember it. They won’t miss it, nor will another be made."
+John the Baptist,Forerunner of Jesus,Matthew,12,5,"Or have you not read in the law, that on the Sabbath day, the priests in the temple profane the Sabbath, and are guiltless?"
+Jesus Christ,Son of God,Matthew,5,10,"Blessed are those who have been persecuted for righteousness’ sake,
+
+for theirs is the Kingdom of Heaven."
+Mary,Mother of Jesus,Luke,6,15,"Matthew; Thomas; James, the son of Alphaeus; Simon, who was called the Zealot;"
+Peter,Apostle,Matthew,4,2,"When he had fasted forty days and forty nights, he was hungry afterward."
+Andrew,Apostle,Matthew,3,3,Request did not work properly
+James the Greater,Apostle,Matthew,5,8,Request did not work properly
+John the Evangelist,Apostle,John,3,4,Request did not work properly
+Philip,Apostle,Matthew,6,9,Request did not work properly
+Thomas,Apostle,Matthew,4,6,Request did not work properly
+James the Lesser,Apostle,Matthew,18,9,Request did not work properly
+Jude Thaddeus,Apostle,Matthew,9,12,Request did not work properly
+Simon the Zealot,Apostle,Matthew,27,3,Request did not work properly
+Bartholomew,Apostle,Matthew,6,2,Request did not work properly
diff --git a/data/madrid_forecast.csv b/data/madrid_forecast.csv
new file mode 100644
index 0000000..afbbe71
--- /dev/null
+++ b/data/madrid_forecast.csv
@@ -0,0 +1,49 @@
+cloudBase,cloudCeiling,cloudCover,dewPoint,evapotranspiration,freezingRainIntensity,humidity,iceAccumulation,iceAccumulationLwe,precipitationProbability,pressureSurfaceLevel,rainAccumulation,rainAccumulationLwe,rainIntensity,sleetAccumulation,sleetAccumulationLwe,sleetIntensity,snowAccumulation,snowAccumulationLwe,snowIntensity,temperature,temperatureApparent,uvHealthConcern,uvIndex,visibility,weatherCode,windDirection,windGust,windSpeed,time,location
+0.37,,48,11.0,0.039,0,82,0,0,0,933.54,0.0,0.0,0.0,0,0,0,0,0,0,13.88,13.88,0,0,9.99,1101,199.63,9.13,4.63,2023-10-28T20:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.37,,44,11.0,0.036,0,82,0,0,0,933.51,0.0,0.0,0.0,0,0,0,0,0,0,13.88,13.88,0,0,9.07,1101,190.13,8.88,4.38,2023-10-28T21:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.38,0.38,75,10.88,0.036,0,82,0,0,0,933.78,0.51,0.51,0.0,0,0,0,0,0,0,13.88,13.88,0,0,10.24,1001,179.0,8.81,4.38,2023-10-28T22:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.13,0.13,75,11.88,0.034,0,93,0,0,0,933.73,0.0,0.0,0.0,0,0,0,0,0,0,13.0,13.0,0,0,13.42,1001,239.5,10.5,4.13,2023-10-28T23:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.13,0.13,75,11.88,0.032,0,93,0,0,0,933.3,0.0,0.0,0.0,0,0,0,0,0,0,13.0,13.0,0,0,9.99,1001,198.13,11.38,4.81,2023-10-29T00:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.12,0.12,97,11.88,0.024,0,94,0,0,0,933.36,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.82,1001,177.81,10.63,4.38,2023-10-29T01:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.24,0.24,97,11.0,0.027,0,88,0,0,0,932.98,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.99,1001,188.88,9.5,3.69,2023-10-29T02:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.12,0.12,97,11.88,0.027,0,94,0,0,0,932.48,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.99,1001,188.63,10.63,3.81,2023-10-29T03:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.24,0.24,97,11.0,0.026,0,88,0,0,0,932.22,0.0,0.0,0.0,0,0,0,0,0,0,13.0,13.0,0,0,10.54,1001,198.63,10.38,4.81,2023-10-29T04:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.23,0.23,94,11.0,0.025,0,89,0,0,0,932.46,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,11.15,1001,178.0,10.69,3.81,2023-10-29T05:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.23,0.23,75,10.88,0.028,0,88,0,0,0,932.18,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.99,1001,169.19,10.63,3.38,2023-10-29T06:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.35,0.35,71,10.0,0.031,0,83,0,0,0,932.31,0.0,0.0,0.0,0,0,0,0,0,0,12.81,12.81,0,0,9.99,1102,179.88,9.88,3.19,2023-10-29T07:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.35,0.35,75,10.0,0.034,0,83,0,0,0,932.85,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.99,1001,168.69,9.63,3.13,2023-10-29T08:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.35,0.35,73,10.13,0.042,0,83,0,0,0,933.44,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.99,1102,175.5,9.19,3.81,2023-10-29T09:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.46,0.46,76,10.13,0.095,0,78,0,0,0,932.84,0.0,0.0,0.0,0,0,0,0,0,0,13.81,13.81,0,1,8.19,1001,179.13,12.19,5.19,2023-10-29T10:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.44,0.44,76,11.31,0.117,0,79,0,0,0,932.5,0.0,0.0,0.0,0,0,0,0,0,0,14.81,14.81,0,1,10.7,1001,188.13,12.69,6.88,2023-10-29T11:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.54,0.54,76,10.38,0.085,0,75,0,0,0,932.1,0.04,0.04,0.0,0,0,0,0,0,0,14.69,14.69,0,1,9.99,1001,205.38,10.81,4.88,2023-10-29T12:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.67,0.67,77,10.31,0.069,0,71,0,0,0,931.5,0.0,0.0,0.0,0,0,0,0,0,0,15.69,15.69,0,1,9.99,1001,200.38,10.38,6.5,2023-10-29T13:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.63,0.63,76,11.0,0.052,0,72,0,0,0,931.13,0.0,0.0,0.0,0,0,0,0,0,0,15.88,15.88,0,0,8.99,1001,199.88,11.31,4.63,2023-10-29T14:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.59,0.59,75,11.19,0.103,0,74,0,0,0,930.47,0.0,0.0,0.0,0,0,0,0,0,0,15.88,15.88,0,0,9.46,1001,197.69,9.81,4.88,2023-10-29T15:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.51,0.51,75,11.69,0.031,0,77,0,0,0,930.3,0.0,0.0,0.0,0,0,0,0,0,0,15.81,15.81,0,0,9.88,1001,198.88,8.69,5.69,2023-10-29T16:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.27,0.27,75,12.81,0.009,0,87,0,0,0,930.53,0.0,0.0,0.0,0,0,0,0,0,0,15.0,15.0,0,0,9.98,1001,215.38,8.0,2.63,2023-10-29T17:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.51,0.51,75,11.81,0.03,0,77,0,0,0,930.75,0.07,0.07,0.0,0,0,0,0,0,0,15.88,15.88,0,0,10.2,1001,181.19,8.69,6.0,2023-10-29T18:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.5,0.5,75,10.88,0.023,0,77,0,0,30,931.2,0.63,0.63,0.25,0,0,0,0,0,0,14.88,14.88,0,0,8.98,1001,168.31,8.31,4.69,2023-10-29T19:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.37,,48,11.0,0.039,0,82,0,0,0,933.54,0.0,0.0,0.0,0,0,0,0,0,0,13.88,13.88,0,0,9.99,1101,199.63,9.13,4.63,2023-10-28T20:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.37,,44,11.0,0.036,0,82,0,0,0,933.51,0.0,0.0,0.0,0,0,0,0,0,0,13.88,13.88,0,0,9.07,1101,190.13,8.88,4.38,2023-10-28T21:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.38,0.38,75,10.88,0.036,0,82,0,0,0,933.78,0.51,0.51,0.0,0,0,0,0,0,0,13.88,13.88,0,0,10.24,1001,179.0,8.81,4.38,2023-10-28T22:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.13,0.13,75,11.88,0.034,0,93,0,0,0,933.73,0.0,0.0,0.0,0,0,0,0,0,0,13.0,13.0,0,0,13.42,1001,239.5,10.5,4.13,2023-10-28T23:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.13,0.13,75,11.88,0.032,0,93,0,0,0,933.3,0.0,0.0,0.0,0,0,0,0,0,0,13.0,13.0,0,0,9.99,1001,198.13,11.38,4.81,2023-10-29T00:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.12,0.12,97,11.88,0.024,0,94,0,0,0,933.36,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.82,1001,177.81,10.63,4.38,2023-10-29T01:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.24,0.24,97,11.0,0.027,0,88,0,0,0,932.98,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.99,1001,188.88,9.5,3.69,2023-10-29T02:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.12,0.12,97,11.88,0.027,0,94,0,0,0,932.48,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.99,1001,188.63,10.63,3.81,2023-10-29T03:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.24,0.24,97,11.0,0.026,0,88,0,0,0,932.22,0.0,0.0,0.0,0,0,0,0,0,0,13.0,13.0,0,0,10.54,1001,198.63,10.38,4.81,2023-10-29T04:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.23,0.23,94,11.0,0.025,0,89,0,0,0,932.46,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,11.15,1001,178.0,10.69,3.81,2023-10-29T05:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.23,0.23,75,10.88,0.028,0,88,0,0,0,932.18,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.99,1001,169.19,10.63,3.38,2023-10-29T06:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.35,0.35,71,10.0,0.031,0,83,0,0,0,932.31,0.0,0.0,0.0,0,0,0,0,0,0,12.81,12.81,0,0,9.99,1102,179.88,9.88,3.19,2023-10-29T07:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.35,0.35,75,10.0,0.034,0,83,0,0,0,932.85,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.99,1001,168.69,9.63,3.13,2023-10-29T08:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.35,0.35,73,10.13,0.042,0,83,0,0,0,933.44,0.0,0.0,0.0,0,0,0,0,0,0,12.88,12.88,0,0,9.99,1102,175.5,9.19,3.81,2023-10-29T09:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.46,0.46,76,10.13,0.095,0,78,0,0,0,932.84,0.0,0.0,0.0,0,0,0,0,0,0,13.81,13.81,0,1,8.19,1001,179.13,12.19,5.19,2023-10-29T10:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.44,0.44,76,11.31,0.117,0,79,0,0,0,932.5,0.0,0.0,0.0,0,0,0,0,0,0,14.81,14.81,0,1,10.7,1001,188.13,12.69,6.88,2023-10-29T11:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.54,0.54,76,10.38,0.085,0,75,0,0,0,932.1,0.04,0.04,0.0,0,0,0,0,0,0,14.69,14.69,0,1,9.99,1001,205.38,10.81,4.88,2023-10-29T12:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.67,0.67,77,10.31,0.069,0,71,0,0,0,931.5,0.0,0.0,0.0,0,0,0,0,0,0,15.69,15.69,0,1,9.99,1001,200.38,10.38,6.5,2023-10-29T13:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.63,0.63,76,11.0,0.052,0,72,0,0,0,931.13,0.0,0.0,0.0,0,0,0,0,0,0,15.88,15.88,0,0,8.99,1001,199.88,11.31,4.63,2023-10-29T14:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.59,0.59,75,11.19,0.103,0,74,0,0,0,930.47,0.0,0.0,0.0,0,0,0,0,0,0,15.88,15.88,0,0,9.46,1001,197.69,9.81,4.88,2023-10-29T15:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.51,0.51,75,11.69,0.031,0,77,0,0,0,930.3,0.0,0.0,0.0,0,0,0,0,0,0,15.81,15.81,0,0,9.88,1001,198.88,8.69,5.69,2023-10-29T16:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.27,0.27,75,12.81,0.009,0,87,0,0,0,930.53,0.0,0.0,0.0,0,0,0,0,0,0,15.0,15.0,0,0,9.98,1001,215.38,8.0,2.63,2023-10-29T17:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.51,0.51,75,11.81,0.03,0,77,0,0,0,930.75,0.07,0.07,0.0,0,0,0,0,0,0,15.88,15.88,0,0,10.2,1001,181.19,8.69,6.0,2023-10-29T18:00:00Z,"Madrid, Comunidad de Madrid, España"
+0.5,0.5,75,10.88,0.023,0,77,0,0,30,931.2,0.63,0.63,0.25,0,0,0,0,0,0,14.88,14.88,0,0,8.98,1001,168.31,8.31,4.69,2023-10-29T19:00:00Z,"Madrid, Comunidad de Madrid, España"
diff --git a/data/monthly_dog_facts.csv b/data/monthly_dog_facts.csv
new file mode 100644
index 0000000..1b712dd
--- /dev/null
+++ b/data/monthly_dog_facts.csv
@@ -0,0 +1,11 @@
+facts,success
+Many foot disorders in dogs are caused by long toenails.,True
+"Just like human fingerprints, no two dogs' nose prints are alike.",True
+"Two stray dogs in Afghanistan saved 50 American soliders. A Facebook group raised $21,000 to bring the dogs back to the US and reunite them with the soldiers.",True
+"The border collie or sheep dog is often considered to be the most intelligent breed of dog some of them have been trained to recognize the words for up to 1,000 objects and retrieved them by verbal command.",True
+Male dogs have a bone in their penis.,True
+The most popular breed of domestic dog in the US and the UK is the Labrador Retriever.,True
+A dog’s vision is not fully developed until after the first month.,True
+Dogs are natural pack animals.,True
+The Russians trained dogs during WWII to run suicide missions with mines strapped to their backs.,True
+"Paul McCartney of the Beatles recorded a high pitched whistle at the end of ""A Day in the Life"" for his dog.",True
diff --git a/your-code/challenge-1.ipynb b/your-code/challenge-1.ipynb
index fee20c4..f6e1717 100644
--- a/your-code/challenge-1.ipynb
+++ b/your-code/challenge-1.ipynb
@@ -10,11 +10,15 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 106,
"id": "215eb6bc",
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "import pandas as pd\n",
+ "import requests\n",
+ "import datetime"
+ ]
},
{
"cell_type": "markdown",
@@ -42,34 +46,34 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 107,
"id": "8c147eb7",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here\n",
- "# base_url"
+ "# base_url\n",
+ "base_url = \"http://dog-api.kinduff.com\""
]
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 108,
"id": "c503211c",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here\n",
- "# endpoint "
+ "# endpoint \n",
+ "endpoint = \"/api/facts\""
]
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 109,
"id": "e8563709",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "url_for_request = base_url + endpoint"
]
},
{
@@ -82,12 +86,25 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 110,
"id": "311d0c28",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "{'facts': ['George Washington had 36 dogs–all Foxhounds–with one named Sweetlips.'],\n",
+ " 'success': True}"
+ ]
+ },
+ "execution_count": 110,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here"
+ "request = requests.get(url_for_request)\n",
+ "request.json()"
]
},
{
@@ -110,12 +127,21 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 111,
"id": "e7dc2129",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "def request_dog_facts():\n",
+ " base_url = \"http://dog-api.kinduff.com\"\n",
+ " endpoint = \"/api/facts\"\n",
+ " url_for_request = base_url + endpoint\n",
+ " response = requests.get(url_for_request)\n",
+ " try:\n",
+ " response = requests.get(url_for_request)\n",
+ " return response.json()\n",
+ " except requests.exceptions.HTTPError as e:\n",
+ " print(f\"Request failed with status code: {e.response.status_code}\")"
]
},
{
@@ -136,12 +162,24 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 112,
"id": "9263e7c8",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "{'facts': ['The Labrador Retriever is the #1 favorite breed in the U.S., Canada, and the U.K.'],\n",
+ " 'success': True}"
+ ]
+ },
+ "execution_count": 112,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# your code here"
+ "request_dog_facts()"
]
},
{
@@ -162,12 +200,36 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 113,
"id": "1e7947fe",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Current Month: 10\n",
+ "Current Month: 27\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "int"
+ ]
+ },
+ "execution_count": 113,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here"
+ "current_month = datetime.datetime.now().month\n",
+ "current_day = datetime.datetime.now().day\n",
+ "\n",
+ "print(\"Current Month:\", current_month)\n",
+ "print(\"Current Month:\", current_day)\n",
+ "type(current_month)"
]
},
{
@@ -180,14 +242,51 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 114,
"id": "731959ec",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "[{'facts': ['Many foot disorders in dogs are caused by long toenails.'],\n",
+ " 'success': True},\n",
+ " {'facts': [\"Just like human fingerprints, no two dogs' nose prints are alike.\"],\n",
+ " 'success': True},\n",
+ " {'facts': ['Two stray dogs in Afghanistan saved 50 American soliders. A Facebook group raised $21,000 to bring the dogs back to the US and reunite them with the soldiers.'],\n",
+ " 'success': True},\n",
+ " {'facts': ['The border collie or sheep dog is often considered to be the most intelligent breed of dog some of them have been trained to recognize the words for up to 1,000 objects and retrieved them by verbal command.'],\n",
+ " 'success': True},\n",
+ " {'facts': ['Male dogs have a bone in their penis.'], 'success': True},\n",
+ " {'facts': ['The most popular breed of domestic dog in the US and the UK is the Labrador Retriever.'],\n",
+ " 'success': True},\n",
+ " {'facts': ['A dog’s vision is not fully developed until after the first month.'],\n",
+ " 'success': True},\n",
+ " {'facts': ['Dogs are natural pack animals.'], 'success': True},\n",
+ " {'facts': ['The Russians trained dogs during WWII to run suicide missions with mines strapped to their backs.'],\n",
+ " 'success': True},\n",
+ " {'facts': ['Paul McCartney of the Beatles recorded a high pitched whistle at the end of \"A Day in the Life\" for his dog.'],\n",
+ " 'success': True}]"
+ ]
+ },
+ "execution_count": 114,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here"
+ "facts_per_month = [request_dog_facts() for _ in range(current_month)]\n",
+ "facts_per_month"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "03abdfef",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ },
{
"cell_type": "markdown",
"id": "ec3a47d4",
@@ -198,12 +297,121 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 115,
"id": "d22652ed",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "monthly_dog_fact = pd.DataFrame(facts_per_month)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 116,
+ "id": "60d0ef28",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " facts | \n",
+ " success | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " [Many foot disorders in dogs are caused by lon... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " [Just like human fingerprints, no two dogs' no... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " [Two stray dogs in Afghanistan saved 50 Americ... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " [The border collie or sheep dog is often consi... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " [Male dogs have a bone in their penis.] | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " [The most popular breed of domestic dog in the... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " [A dog’s vision is not fully developed until a... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " [Dogs are natural pack animals.] | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " [The Russians trained dogs during WWII to run ... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " [Paul McCartney of the Beatles recorded a high... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " facts success\n",
+ "0 [Many foot disorders in dogs are caused by lon... True\n",
+ "1 [Just like human fingerprints, no two dogs' no... True\n",
+ "2 [Two stray dogs in Afghanistan saved 50 Americ... True\n",
+ "3 [The border collie or sheep dog is often consi... True\n",
+ "4 [Male dogs have a bone in their penis.] True\n",
+ "5 [The most popular breed of domestic dog in the... True\n",
+ "6 [A dog’s vision is not fully developed until a... True\n",
+ "7 [Dogs are natural pack animals.] True\n",
+ "8 [The Russians trained dogs during WWII to run ... True\n",
+ "9 [Paul McCartney of the Beatles recorded a high... True"
+ ]
+ },
+ "execution_count": 116,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "monthly_dog_fact"
]
},
{
@@ -216,12 +424,112 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": 117,
"id": "b29f4826",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " facts | \n",
+ " success | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Many foot disorders in dogs are caused by long... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Just like human fingerprints, no two dogs' nos... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " Two stray dogs in Afghanistan saved 50 America... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " The border collie or sheep dog is often consid... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Male dogs have a bone in their penis. | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " The most popular breed of domestic dog in the ... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " A dog’s vision is not fully developed until af... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " Dogs are natural pack animals. | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " The Russians trained dogs during WWII to run s... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " Paul McCartney of the Beatles recorded a high ... | \n",
+ " True | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " facts success\n",
+ "0 Many foot disorders in dogs are caused by long... True\n",
+ "1 Just like human fingerprints, no two dogs' nos... True\n",
+ "2 Two stray dogs in Afghanistan saved 50 America... True\n",
+ "3 The border collie or sheep dog is often consid... True\n",
+ "4 Male dogs have a bone in their penis. True\n",
+ "5 The most popular breed of domestic dog in the ... True\n",
+ "6 A dog’s vision is not fully developed until af... True\n",
+ "7 Dogs are natural pack animals. True\n",
+ "8 The Russians trained dogs during WWII to run s... True\n",
+ "9 Paul McCartney of the Beatles recorded a high ... True"
+ ]
+ },
+ "execution_count": 117,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here"
+ "monthly_dog_fact[\"facts\"] = monthly_dog_fact[\"facts\"].apply(lambda x: x[0]) # (lambda x: str(x)) also works\n",
+ "monthly_dog_fact"
]
},
{
@@ -242,12 +550,12 @@
},
{
"cell_type": "code",
- "execution_count": 50,
+ "execution_count": 118,
"id": "ca21a372",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "monthly_dog_fact.to_csv(\"../data/monthly_dog_facts.csv\", index=False)"
]
}
],
@@ -255,7 +563,7 @@
"kernelspec": {
"display_name": "ironhack",
"language": "python",
- "name": "ironhack"
+ "name": "python3"
},
"language_info": {
"codemirror_mode": {
diff --git a/your-code/challenge-2.ipynb b/your-code/challenge-2.ipynb
index a573e5f..ab6690a 100644
--- a/your-code/challenge-2.ipynb
+++ b/your-code/challenge-2.ipynb
@@ -50,12 +50,13 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 33,
"id": "215eb6bc",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "import pandas as pd\n",
+ "import requests"
]
},
{
@@ -76,12 +77,271 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 34,
"id": "6ba76753",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Name | \n",
+ " Role | \n",
+ " Book | \n",
+ " Chapter | \n",
+ " Verse | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Adam | \n",
+ " First Man | \n",
+ " Genesis | \n",
+ " 1 | \n",
+ " 1 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Eve | \n",
+ " First Woman | \n",
+ " Genesis | \n",
+ " 22 | \n",
+ " 5 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " Noah | \n",
+ " Builder of the Ark | \n",
+ " Genesis | \n",
+ " 12 | \n",
+ " 10 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " Abraham | \n",
+ " Father of Nations | \n",
+ " Genesis | \n",
+ " 6 | \n",
+ " 15 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Sarah | \n",
+ " Wife of Abraham | \n",
+ " Genesis | \n",
+ " 28 | \n",
+ " 2 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " Moses | \n",
+ " Leader of the Exodus | \n",
+ " Exodus | \n",
+ " 2 | \n",
+ " 3 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " Aaron | \n",
+ " Brother of Moses | \n",
+ " Exodus | \n",
+ " 13 | \n",
+ " 8 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " David | \n",
+ " King of Israel | \n",
+ " 1 Samuel | \n",
+ " 8 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " Solomon | \n",
+ " Wisest Man | \n",
+ " Proverbs | \n",
+ " 12 | \n",
+ " 9 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " Isaiah | \n",
+ " Prophet | \n",
+ " Isaiah | \n",
+ " 4 | \n",
+ " 6 | \n",
+ "
\n",
+ " \n",
+ " | 10 | \n",
+ " Jeremiah | \n",
+ " Prophet | \n",
+ " Jeremiah | \n",
+ " 3 | \n",
+ " 16 | \n",
+ "
\n",
+ " \n",
+ " | 11 | \n",
+ " John the Baptist | \n",
+ " Forerunner of Jesus | \n",
+ " Matthew | \n",
+ " 12 | \n",
+ " 5 | \n",
+ "
\n",
+ " \n",
+ " | 12 | \n",
+ " Jesus Christ | \n",
+ " Son of God | \n",
+ " Matthew | \n",
+ " 5 | \n",
+ " 10 | \n",
+ "
\n",
+ " \n",
+ " | 13 | \n",
+ " Mary | \n",
+ " Mother of Jesus | \n",
+ " Luke | \n",
+ " 6 | \n",
+ " 15 | \n",
+ "
\n",
+ " \n",
+ " | 14 | \n",
+ " Peter | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 4 | \n",
+ " 2 | \n",
+ "
\n",
+ " \n",
+ " | 15 | \n",
+ " Andrew | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 3 | \n",
+ " 3 | \n",
+ "
\n",
+ " \n",
+ " | 16 | \n",
+ " James the Greater | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 5 | \n",
+ " 8 | \n",
+ "
\n",
+ " \n",
+ " | 17 | \n",
+ " John the Evangelist | \n",
+ " Apostle | \n",
+ " John | \n",
+ " 3 | \n",
+ " 4 | \n",
+ "
\n",
+ " \n",
+ " | 18 | \n",
+ " Philip | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 6 | \n",
+ " 9 | \n",
+ "
\n",
+ " \n",
+ " | 19 | \n",
+ " Thomas | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 4 | \n",
+ " 6 | \n",
+ "
\n",
+ " \n",
+ " | 20 | \n",
+ " James the Lesser | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 18 | \n",
+ " 9 | \n",
+ "
\n",
+ " \n",
+ " | 21 | \n",
+ " Jude Thaddeus | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 9 | \n",
+ " 12 | \n",
+ "
\n",
+ " \n",
+ " | 22 | \n",
+ " Simon the Zealot | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 27 | \n",
+ " 3 | \n",
+ "
\n",
+ " \n",
+ " | 23 | \n",
+ " Bartholomew | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 6 | \n",
+ " 2 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Name Role Book Chapter Verse\n",
+ "0 Adam First Man Genesis 1 1\n",
+ "1 Eve First Woman Genesis 22 5\n",
+ "2 Noah Builder of the Ark Genesis 12 10\n",
+ "3 Abraham Father of Nations Genesis 6 15\n",
+ "4 Sarah Wife of Abraham Genesis 28 2\n",
+ "5 Moses Leader of the Exodus Exodus 2 3\n",
+ "6 Aaron Brother of Moses Exodus 13 8\n",
+ "7 David King of Israel 1 Samuel 8 4\n",
+ "8 Solomon Wisest Man Proverbs 12 9\n",
+ "9 Isaiah Prophet Isaiah 4 6\n",
+ "10 Jeremiah Prophet Jeremiah 3 16\n",
+ "11 John the Baptist Forerunner of Jesus Matthew 12 5\n",
+ "12 Jesus Christ Son of God Matthew 5 10\n",
+ "13 Mary Mother of Jesus Luke 6 15\n",
+ "14 Peter Apostle Matthew 4 2\n",
+ "15 Andrew Apostle Matthew 3 3\n",
+ "16 James the Greater Apostle Matthew 5 8\n",
+ "17 John the Evangelist Apostle John 3 4\n",
+ "18 Philip Apostle Matthew 6 9\n",
+ "19 Thomas Apostle Matthew 4 6\n",
+ "20 James the Lesser Apostle Matthew 18 9\n",
+ "21 Jude Thaddeus Apostle Matthew 9 12\n",
+ "22 Simon the Zealot Apostle Matthew 27 3\n",
+ "23 Bartholomew Apostle Matthew 6 2"
+ ]
+ },
+ "execution_count": 34,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here"
+ "df = pd.read_csv(\"../data/bible.csv\")\n",
+ "df"
]
},
{
@@ -110,12 +370,40 @@
},
{
"cell_type": "code",
- "execution_count": 34,
+ "execution_count": 35,
"id": "8ab21dfb",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "{'reference': 'John 3:16',\n",
+ " 'verses': [{'book_id': 'JHN',\n",
+ " 'book_name': 'John',\n",
+ " 'chapter': 3,\n",
+ " 'verse': 16,\n",
+ " 'text': '\\nFor God so loved the world, that he gave his one and only Son, that whoever believes in him should not perish, but have eternal life.\\n\\n'}],\n",
+ " 'text': '\\nFor God so loved the world, that he gave his one and only Son, that whoever believes in him should not perish, but have eternal life.\\n\\n',\n",
+ " 'translation_id': 'web',\n",
+ " 'translation_name': 'World English Bible',\n",
+ " 'translation_note': 'Public Domain'}"
+ ]
+ },
+ "execution_count": 35,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here"
+ "base_url = \"https://bible-api.com\"\n",
+ "endpoint = \"/john 3:16\"\n",
+ "\n",
+ "url_for_request = base_url + endpoint\n",
+ "\n",
+ "request = requests.get(url_for_request)\n",
+ "\n",
+ "response = request.json()\n",
+ "response"
]
},
{
@@ -128,12 +416,23 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 36,
"id": "5ac1bcd2",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "'For God so loved the world, that he gave his one and only Son, that whoever believes in him should not perish, but have eternal life.'"
+ ]
+ },
+ "execution_count": 36,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here"
+ "response['text'].strip()"
]
},
{
@@ -154,12 +453,34 @@
},
{
"cell_type": "code",
- "execution_count": 6,
- "id": "b3a9a0f0",
+ "execution_count": 51,
+ "id": "3defd857",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def get_response(book, chapter, verse):\n",
+ " base_url = 'https://bible-api.com/'\n",
+ " endpoint = f'{book} {chapter}:{verse}'\n",
+ " url_for_request = base_url + endpoint\n",
+ " res = requests.get(url_for_request)\n",
+ " \n",
+ " if res.status_code == 200:\n",
+ " data = res.json()\n",
+ " text = data['text']\n",
+ " text_cleaned = text.strip()\n",
+ " return text_cleaned\n",
+ " else:\n",
+ " return \"Request did not work properly\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 52,
+ "id": "a50343e9",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "df['Text'] = df.apply(lambda row: get_response(row['Book'], row['Chapter'], row['Verse']), axis=1)\n"
]
},
{
@@ -170,6 +491,325 @@
"# Save the dataframe into the data folder. "
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 53,
+ "id": "e4951a45",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Name | \n",
+ " Role | \n",
+ " Book | \n",
+ " Chapter | \n",
+ " Verse | \n",
+ " Text | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Adam | \n",
+ " First Man | \n",
+ " Genesis | \n",
+ " 1 | \n",
+ " 1 | \n",
+ " In the beginning, God created the heavens and ... | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Eve | \n",
+ " First Woman | \n",
+ " Genesis | \n",
+ " 22 | \n",
+ " 5 | \n",
+ " Abraham said to his young men, “Stay here with... | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " Noah | \n",
+ " Builder of the Ark | \n",
+ " Genesis | \n",
+ " 12 | \n",
+ " 10 | \n",
+ " There was a famine in the land. Abram went dow... | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " Abraham | \n",
+ " Father of Nations | \n",
+ " Genesis | \n",
+ " 6 | \n",
+ " 15 | \n",
+ " This is how you shall make it. The length of t... | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Sarah | \n",
+ " Wife of Abraham | \n",
+ " Genesis | \n",
+ " 28 | \n",
+ " 2 | \n",
+ " Arise, go to Paddan Aram, to the house of Beth... | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " Moses | \n",
+ " Leader of the Exodus | \n",
+ " Exodus | \n",
+ " 2 | \n",
+ " 3 | \n",
+ " When she could no longer hide him, she took a ... | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " Aaron | \n",
+ " Brother of Moses | \n",
+ " Exodus | \n",
+ " 13 | \n",
+ " 8 | \n",
+ " You shall tell your son in that day, saying, ‘... | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " David | \n",
+ " King of Israel | \n",
+ " 1 Samuel | \n",
+ " 8 | \n",
+ " 4 | \n",
+ " Then all the elders of Israel gathered themsel... | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " Solomon | \n",
+ " Wisest Man | \n",
+ " Proverbs | \n",
+ " 12 | \n",
+ " 9 | \n",
+ " Better is he who is little know, and has a ser... | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " Isaiah | \n",
+ " Prophet | \n",
+ " Isaiah | \n",
+ " 4 | \n",
+ " 6 | \n",
+ " There will be a pavilion for a shade in the da... | \n",
+ "
\n",
+ " \n",
+ " | 10 | \n",
+ " Jeremiah | \n",
+ " Prophet | \n",
+ " Jeremiah | \n",
+ " 3 | \n",
+ " 16 | \n",
+ " It will come to pass, when you are multiplied ... | \n",
+ "
\n",
+ " \n",
+ " | 11 | \n",
+ " John the Baptist | \n",
+ " Forerunner of Jesus | \n",
+ " Matthew | \n",
+ " 12 | \n",
+ " 5 | \n",
+ " Or have you not read in the law, that on the S... | \n",
+ "
\n",
+ " \n",
+ " | 12 | \n",
+ " Jesus Christ | \n",
+ " Son of God | \n",
+ " Matthew | \n",
+ " 5 | \n",
+ " 10 | \n",
+ " Blessed are those who have been persecuted for... | \n",
+ "
\n",
+ " \n",
+ " | 13 | \n",
+ " Mary | \n",
+ " Mother of Jesus | \n",
+ " Luke | \n",
+ " 6 | \n",
+ " 15 | \n",
+ " Matthew; Thomas; James, the son of Alphaeus; S... | \n",
+ "
\n",
+ " \n",
+ " | 14 | \n",
+ " Peter | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 4 | \n",
+ " 2 | \n",
+ " When he had fasted forty days and forty nights... | \n",
+ "
\n",
+ " \n",
+ " | 15 | \n",
+ " Andrew | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 3 | \n",
+ " 3 | \n",
+ " Request did not work properly | \n",
+ "
\n",
+ " \n",
+ " | 16 | \n",
+ " James the Greater | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 5 | \n",
+ " 8 | \n",
+ " Request did not work properly | \n",
+ "
\n",
+ " \n",
+ " | 17 | \n",
+ " John the Evangelist | \n",
+ " Apostle | \n",
+ " John | \n",
+ " 3 | \n",
+ " 4 | \n",
+ " Request did not work properly | \n",
+ "
\n",
+ " \n",
+ " | 18 | \n",
+ " Philip | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 6 | \n",
+ " 9 | \n",
+ " Request did not work properly | \n",
+ "
\n",
+ " \n",
+ " | 19 | \n",
+ " Thomas | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 4 | \n",
+ " 6 | \n",
+ " Request did not work properly | \n",
+ "
\n",
+ " \n",
+ " | 20 | \n",
+ " James the Lesser | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 18 | \n",
+ " 9 | \n",
+ " Request did not work properly | \n",
+ "
\n",
+ " \n",
+ " | 21 | \n",
+ " Jude Thaddeus | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 9 | \n",
+ " 12 | \n",
+ " Request did not work properly | \n",
+ "
\n",
+ " \n",
+ " | 22 | \n",
+ " Simon the Zealot | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 27 | \n",
+ " 3 | \n",
+ " Request did not work properly | \n",
+ "
\n",
+ " \n",
+ " | 23 | \n",
+ " Bartholomew | \n",
+ " Apostle | \n",
+ " Matthew | \n",
+ " 6 | \n",
+ " 2 | \n",
+ " Request did not work properly | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Name Role Book Chapter Verse \\\n",
+ "0 Adam First Man Genesis 1 1 \n",
+ "1 Eve First Woman Genesis 22 5 \n",
+ "2 Noah Builder of the Ark Genesis 12 10 \n",
+ "3 Abraham Father of Nations Genesis 6 15 \n",
+ "4 Sarah Wife of Abraham Genesis 28 2 \n",
+ "5 Moses Leader of the Exodus Exodus 2 3 \n",
+ "6 Aaron Brother of Moses Exodus 13 8 \n",
+ "7 David King of Israel 1 Samuel 8 4 \n",
+ "8 Solomon Wisest Man Proverbs 12 9 \n",
+ "9 Isaiah Prophet Isaiah 4 6 \n",
+ "10 Jeremiah Prophet Jeremiah 3 16 \n",
+ "11 John the Baptist Forerunner of Jesus Matthew 12 5 \n",
+ "12 Jesus Christ Son of God Matthew 5 10 \n",
+ "13 Mary Mother of Jesus Luke 6 15 \n",
+ "14 Peter Apostle Matthew 4 2 \n",
+ "15 Andrew Apostle Matthew 3 3 \n",
+ "16 James the Greater Apostle Matthew 5 8 \n",
+ "17 John the Evangelist Apostle John 3 4 \n",
+ "18 Philip Apostle Matthew 6 9 \n",
+ "19 Thomas Apostle Matthew 4 6 \n",
+ "20 James the Lesser Apostle Matthew 18 9 \n",
+ "21 Jude Thaddeus Apostle Matthew 9 12 \n",
+ "22 Simon the Zealot Apostle Matthew 27 3 \n",
+ "23 Bartholomew Apostle Matthew 6 2 \n",
+ "\n",
+ " Text \n",
+ "0 In the beginning, God created the heavens and ... \n",
+ "1 Abraham said to his young men, “Stay here with... \n",
+ "2 There was a famine in the land. Abram went dow... \n",
+ "3 This is how you shall make it. The length of t... \n",
+ "4 Arise, go to Paddan Aram, to the house of Beth... \n",
+ "5 When she could no longer hide him, she took a ... \n",
+ "6 You shall tell your son in that day, saying, ‘... \n",
+ "7 Then all the elders of Israel gathered themsel... \n",
+ "8 Better is he who is little know, and has a ser... \n",
+ "9 There will be a pavilion for a shade in the da... \n",
+ "10 It will come to pass, when you are multiplied ... \n",
+ "11 Or have you not read in the law, that on the S... \n",
+ "12 Blessed are those who have been persecuted for... \n",
+ "13 Matthew; Thomas; James, the son of Alphaeus; S... \n",
+ "14 When he had fasted forty days and forty nights... \n",
+ "15 Request did not work properly \n",
+ "16 Request did not work properly \n",
+ "17 Request did not work properly \n",
+ "18 Request did not work properly \n",
+ "19 Request did not work properly \n",
+ "20 Request did not work properly \n",
+ "21 Request did not work properly \n",
+ "22 Request did not work properly \n",
+ "23 Request did not work properly "
+ ]
+ },
+ "execution_count": 53,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df"
+ ]
+ },
{
"cell_type": "markdown",
"id": "2b334e3d",
@@ -180,20 +820,28 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 54,
"id": "556829be",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "df.to_csv('../data/bible_with_verse_text.csv', index = False)"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "0e0f1dd2",
+ "metadata": {},
+ "outputs": [],
+ "source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "ironhack",
"language": "python",
- "name": "ironhack"
+ "name": "python3"
},
"language_info": {
"codemirror_mode": {
diff --git a/your-code/challenge-3.ipynb b/your-code/challenge-3.ipynb
index d6fc5b0..a37fa96 100644
--- a/your-code/challenge-3.ipynb
+++ b/your-code/challenge-3.ipynb
@@ -10,11 +10,15 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"id": "215eb6bc",
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "import requests\n",
+ "import pandas as pd\n",
+ "import getpass"
+ ]
},
{
"cell_type": "markdown",
@@ -50,12 +54,12 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 12,
"id": "7ea8624f",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "token = getpass.getpass(\"Enter your token: \")"
]
},
{
@@ -68,12 +72,12 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 13,
"id": "968e4e9c",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "location = \"madrid\""
]
},
{
@@ -86,12 +90,12 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 14,
"id": "bdc7c366",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "url = f\"https://api.tomorrow.io/v4/weather/history/recent?location={location}&apikey={token}\""
]
},
{
@@ -104,12 +108,26 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 15,
"id": "8355e9e6",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "def get_weather_response (location, token):\n",
+ " url = f\"https://api.tomorrow.io/v4/weather/history/recent?location={location}&apikey={token}\"\n",
+ " headers = {\"accept\": \"application/json\"}\n",
+ " res = requests.get(url, headers=headers)\n",
+ " return res.json()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "id": "f8bf0716",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "data = get_weather_response (location, token)"
]
},
{
@@ -120,6 +138,30 @@
"# Last step will be to turn it into a Dataframe! 🐼"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "id": "107fe8a5",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "all_data = []\n",
+ "def get_responses_into_df (data):\n",
+ "\n",
+ " for element in data:\n",
+ " response = data['timelines']['hourly']\n",
+ " location = data['location']['name']\n",
+ " for entry in response:\n",
+ " data_dict = entry['values']\n",
+ " data_dict['time'] = entry['time']\n",
+ " all_data.append(data_dict)\n",
+ " \n",
+ " df = pd.DataFrame(all_data)\n",
+ " df['location'] = data['location']['name']\n",
+ " \n",
+ " return df"
+ ]
+ },
{
"cell_type": "markdown",
"id": "d99fe0fd",
@@ -138,12 +180,227 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 18,
"id": "788c6d98",
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " cloudBase | \n",
+ " cloudCeiling | \n",
+ " cloudCover | \n",
+ " dewPoint | \n",
+ " evapotranspiration | \n",
+ " freezingRainIntensity | \n",
+ " humidity | \n",
+ " iceAccumulation | \n",
+ " iceAccumulationLwe | \n",
+ " precipitationProbability | \n",
+ " ... | \n",
+ " temperatureApparent | \n",
+ " uvHealthConcern | \n",
+ " uvIndex | \n",
+ " visibility | \n",
+ " weatherCode | \n",
+ " windDirection | \n",
+ " windGust | \n",
+ " windSpeed | \n",
+ " time | \n",
+ " location | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 0.37 | \n",
+ " NaN | \n",
+ " 48 | \n",
+ " 11.00 | \n",
+ " 0.039 | \n",
+ " 0 | \n",
+ " 82 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " ... | \n",
+ " 13.88 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 9.99 | \n",
+ " 1101 | \n",
+ " 199.63 | \n",
+ " 9.13 | \n",
+ " 4.63 | \n",
+ " 2023-10-28T20:00:00Z | \n",
+ " Madrid, Comunidad de Madrid, España | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 0.37 | \n",
+ " NaN | \n",
+ " 44 | \n",
+ " 11.00 | \n",
+ " 0.036 | \n",
+ " 0 | \n",
+ " 82 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " ... | \n",
+ " 13.88 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 9.07 | \n",
+ " 1101 | \n",
+ " 190.13 | \n",
+ " 8.88 | \n",
+ " 4.38 | \n",
+ " 2023-10-28T21:00:00Z | \n",
+ " Madrid, Comunidad de Madrid, España | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 0.38 | \n",
+ " 0.38 | \n",
+ " 75 | \n",
+ " 10.88 | \n",
+ " 0.036 | \n",
+ " 0 | \n",
+ " 82 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " ... | \n",
+ " 13.88 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 10.24 | \n",
+ " 1001 | \n",
+ " 179.00 | \n",
+ " 8.81 | \n",
+ " 4.38 | \n",
+ " 2023-10-28T22:00:00Z | \n",
+ " Madrid, Comunidad de Madrid, España | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 0.13 | \n",
+ " 0.13 | \n",
+ " 75 | \n",
+ " 11.88 | \n",
+ " 0.034 | \n",
+ " 0 | \n",
+ " 93 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " ... | \n",
+ " 13.00 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 13.42 | \n",
+ " 1001 | \n",
+ " 239.50 | \n",
+ " 10.50 | \n",
+ " 4.13 | \n",
+ " 2023-10-28T23:00:00Z | \n",
+ " Madrid, Comunidad de Madrid, España | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 0.13 | \n",
+ " 0.13 | \n",
+ " 75 | \n",
+ " 11.88 | \n",
+ " 0.032 | \n",
+ " 0 | \n",
+ " 93 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " ... | \n",
+ " 13.00 | \n",
+ " 0 | \n",
+ " 0 | \n",
+ " 9.99 | \n",
+ " 1001 | \n",
+ " 198.13 | \n",
+ " 11.38 | \n",
+ " 4.81 | \n",
+ " 2023-10-29T00:00:00Z | \n",
+ " Madrid, Comunidad de Madrid, España | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
5 rows × 31 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " cloudBase cloudCeiling cloudCover dewPoint evapotranspiration \\\n",
+ "0 0.37 NaN 48 11.00 0.039 \n",
+ "1 0.37 NaN 44 11.00 0.036 \n",
+ "2 0.38 0.38 75 10.88 0.036 \n",
+ "3 0.13 0.13 75 11.88 0.034 \n",
+ "4 0.13 0.13 75 11.88 0.032 \n",
+ "\n",
+ " freezingRainIntensity humidity iceAccumulation iceAccumulationLwe \\\n",
+ "0 0 82 0 0 \n",
+ "1 0 82 0 0 \n",
+ "2 0 82 0 0 \n",
+ "3 0 93 0 0 \n",
+ "4 0 93 0 0 \n",
+ "\n",
+ " precipitationProbability ... temperatureApparent uvHealthConcern \\\n",
+ "0 0 ... 13.88 0 \n",
+ "1 0 ... 13.88 0 \n",
+ "2 0 ... 13.88 0 \n",
+ "3 0 ... 13.00 0 \n",
+ "4 0 ... 13.00 0 \n",
+ "\n",
+ " uvIndex visibility weatherCode windDirection windGust windSpeed \\\n",
+ "0 0 9.99 1101 199.63 9.13 4.63 \n",
+ "1 0 9.07 1101 190.13 8.88 4.38 \n",
+ "2 0 10.24 1001 179.00 8.81 4.38 \n",
+ "3 0 13.42 1001 239.50 10.50 4.13 \n",
+ "4 0 9.99 1001 198.13 11.38 4.81 \n",
+ "\n",
+ " time location \n",
+ "0 2023-10-28T20:00:00Z Madrid, Comunidad de Madrid, España \n",
+ "1 2023-10-28T21:00:00Z Madrid, Comunidad de Madrid, España \n",
+ "2 2023-10-28T22:00:00Z Madrid, Comunidad de Madrid, España \n",
+ "3 2023-10-28T23:00:00Z Madrid, Comunidad de Madrid, España \n",
+ "4 2023-10-29T00:00:00Z Madrid, Comunidad de Madrid, España \n",
+ "\n",
+ "[5 rows x 31 columns]"
+ ]
+ },
+ "execution_count": 18,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
- "# Your code here"
+ "df = get_responses_into_df(data)\n",
+ "df.head()"
]
},
{
@@ -164,20 +421,28 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 21,
"id": "ca21a372",
"metadata": {},
"outputs": [],
"source": [
- "# Your code here"
+ "df.to_csv('../data/madrid_forecast.csv', index = False)"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "33358f05",
+ "metadata": {},
+ "outputs": [],
+ "source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "ironhack",
"language": "python",
- "name": "ironhack"
+ "name": "python3"
},
"language_info": {
"codemirror_mode": {