From e54458ccb7355481d4e9447cbfe7e005d3bec2e3 Mon Sep 17 00:00:00 2001 From: Ricardo Beato Date: Fri, 27 Oct 2023 14:03:43 +0200 Subject: [PATCH] commiting dogs facts --- your-code/challenge-1.ipynb | 820 +++++++++++++++++++++++++++-- your-code/dogs_facts_dataframe.csv | 28 + 2 files changed, 802 insertions(+), 46 deletions(-) create mode 100644 your-code/dogs_facts_dataframe.csv diff --git a/your-code/challenge-1.ipynb b/your-code/challenge-1.ipynb index fee20c4..0f16ff0 100644 --- a/your-code/challenge-1.ipynb +++ b/your-code/challenge-1.ipynb @@ -10,11 +10,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "215eb6bc", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "import pandas as pd\n", + "from pandas import json_normalize\n", + "\n", + "import requests \n", + "import json\n", + "import os\n", + "#from dotenv import load_dotenv #conda install -c conda-forge python-dotenv\n", + "\n", + "import time\n", + "\n", + "import sys\n", + "sys.path.append(\"../\")" + ] }, { "cell_type": "markdown", @@ -42,34 +55,13 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 6, "id": "8c147eb7", "metadata": {}, "outputs": [], "source": [ "# Your code here\n", - "# base_url" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "c503211c", - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here\n", - "# endpoint " - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "e8563709", - "metadata": {}, - "outputs": [], - "source": [ - "# Your code here" + "url_for_request = \"http://dog-api.kinduff.com/api/facts\"" ] }, { @@ -82,12 +74,25 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "id": "311d0c28", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "{'facts': ['Greyhounds can reach a speed of up to 45 miles per hour.'],\n", + " 'success': True}" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# Your code here" + "request_dogs = requests.get(url_for_request).json()\n", + "request_dogs" ] }, { @@ -110,12 +115,37 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 8, "id": "e7dc2129", "metadata": {}, "outputs": [], "source": [ - "# Your code here" + "def request_dog_facts():\n", + " url_for_request = \"http://dog-api.kinduff.com/api/facts\"\n", + " request_dogs = requests.get(url_for_request).json()\n", + " return request_dogs" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "5852eeea", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'facts': ['The term \"dog days of summer\" was coined by the ancient Greeks and Romans to describe the hottest days of summer that coincided with the rising of the Dog Star, Sirius.'],\n", + " 'success': True}" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "request_dog_facts()" ] }, { @@ -136,12 +166,40 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 10, "id": "9263e7c8", "metadata": {}, "outputs": [], "source": [ - "# your code here" + "def request_dog_facts():\n", + " url_for_request = \"http://dog-api.kinduff.com/api/facts\"\n", + " request_dogs = requests.get(url_for_request).json()\n", + " try:\n", + " return request_dogs\n", + " except:\n", + " print(\"too many requests\")" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "dd409ba8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'facts': ['Dogs can be trained to detect cancer and other diseases in humans.'],\n", + " 'success': True}" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "request_dog_facts()" ] }, { @@ -162,12 +220,82 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 34, "id": "1e7947fe", "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "10" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import datetime\n", + "from datetime import datetime\n", + "current_month = datetime.now().month\n", + "current_month" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "2be1b8e5", + "metadata": {}, "outputs": [], "source": [ - "# Your code here" + "def request_dog_facts():\n", + " current_month = datetime.now().month\n", + " list_dog_facts = []\n", + " for i in range(current_month):\n", + " res = requests.get(url_for_request).json()\n", + " list_dog_facts.append(res)\n", + " return list_dog_facts" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "401739f6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[{'facts': ['Dogs’ nose prints are as unique as a human’s finger prints, and can be used to accurately identify them.'],\n", + " 'success': True},\n", + " {'facts': [\"The wetness of a dog's nose is essential for determining what direction a smell is coming from.\"],\n", + " 'success': True},\n", + " {'facts': ['A person standing still 300 yards away is almost invisible to a dog. But a dog can easily identify its owner standing a mile away if the owner is waving his arms.'],\n", + " 'success': True},\n", + " {'facts': ['In Australia, a man who was arrested for drug possession argued his civil rights were violated when the drug-sniffing dog nuzzled his crotch. While the judge dismissed the charges, they were later reinstated when a prosecutor pointed out that in the animal kingdom, crotch nuzzling was a friendly gesture.'],\n", + " 'success': True},\n", + " {'facts': ['Bingo is the name of the dog on the box of Cracker Jacks.'],\n", + " 'success': True},\n", + " {'facts': ['Puppies sleep 90% of the day for their first few weeks.'],\n", + " 'success': True},\n", + " {'facts': ['Some dogs have shown remarkable ability to detect certain cancers.'],\n", + " 'success': True},\n", + " {'facts': ['It is not possible to know how many puppies a dog will have just by looking. The appearance can be very deceptive.'],\n", + " 'success': True},\n", + " {'facts': ['Wow, check out those choppers! Puppies have 28 teeth and normal adult dogs have 42.'],\n", + " 'success': True},\n", + " {'facts': ['Pekingese and Japanese Chins were so important in the ancient Far East that they had their own servants and were carried around trade routes as gifts for kings and emperors. Pekingese were even worshipped in the temples of China for centuries.'],\n", + " 'success': True}]" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "request_dog_facts()" ] }, { @@ -180,12 +308,178 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 36, "id": "731959ec", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "27" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "current_day = datetime.now().day\n", + "current_day" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "id": "5b6b0bf0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[{'facts': ['Chocolate contains a substance known as theobromine (similar to caffeine) which can kill dogs or, at the very least, make them violently ill.'],\n", + " 'success': True},\n", + " {'facts': ['If never spayed or neutered, a female dog, her mate, and their puppies could produce over 66,000 dogs in 6 years!'],\n", + " 'success': True},\n", + " {'facts': ['Touch is the first sense the dog develops. The entire body, including the paws, is covered with touch-sensitive nerve endings.'],\n", + " 'success': True},\n", + " {'facts': ['Pugs and other dogs with short muzzles have a peculiar head-type known as \"Brachycephalic.\"'],\n", + " 'success': True},\n", + " {'facts': ['Puppies are sometimes rejected by their mother if they are born by cesarean and cleaned up before being given back to her.'],\n", + " 'success': True},\n", + " {'facts': ['Dogs were first domesticated by cavemen.'], 'success': True},\n", + " {'facts': ['Franklin Roosevelt spent $15,000 for a destroyer to pick up his Scottie in the Aleutian Islands.'],\n", + " 'success': True},\n", + " {'facts': ['Watch that plate of cookies! A Dog’s sense of smell is 10,000 – 100,000 times more acute as that of humans.'],\n", + " 'success': True},\n", + " {'facts': ['The bible mentions dogs 14 times.'], 'success': True},\n", + " {'facts': ['Dogs with a flesh colored nose is said to have a \"Dudley Nose.\"'],\n", + " 'success': True},\n", + " {'facts': ['Some stray Russian dogs have figured out how to use the subway system in order to travel to more populated areas in search of food.'],\n", + " 'success': True},\n", + " {'facts': ['A dog can locate the source of a sound in 1/600 of a second and can hear sounds four times farther away than a human can.'],\n", + " 'success': True},\n", + " {'facts': ['Dogs have three eyelids, including one to keep their eyes moist and protected.'],\n", + " 'success': True},\n", + " {'facts': ['Dogs normally have between one to sixteen or even more puppies.'],\n", + " 'success': True},\n", + " {'facts': [\"A dog's average body temperature is 101.2 degrees.\"],\n", + " 'success': True},\n", + " {'facts': ['Dogs are mentioned in the Bible more than 35 times.'],\n", + " 'success': True},\n", + " {'facts': ['Like human babies, Chihuahuas are born with a soft spot in their skull which closes with age.'],\n", + " 'success': True},\n", + " {'facts': ['In 2002 alone, more people in the U.S. were killed by dogs than by sharks in the past 100 years.'],\n", + " 'success': True},\n", + " {'facts': ['The best dog to reportedly attract a date is the Golden Retriever. The worst is the Pit Bull.'],\n", + " 'success': True},\n", + " {'facts': [\"'Frito Feet' is the name of the phenomenon in which the bacteria on a dog's paws cause them to smell like corn chips. Because a pup's feet are in constant contact with the ground, they pick up tons of microorganisms in their paws. When dogs cool off by sweating through the pads of their feet, the combo of moisture and bacteria releaces a nutty, popcorn-like aroma. Basically it's dog B.O.\"],\n", + " 'success': True},\n", + " {'facts': ['The Labrador Retriever is the #1 favorite breed in the U.S., Canada, and the U.K.'],\n", + " 'success': True},\n", + " {'facts': ['The oldest known dog bones were found in Asia and date as far back as 10,000 B.C. The first identifiable dog breed appeared about 9000 B.C. and was probably a type of Greyhound dog used for hunting.'],\n", + " 'success': True},\n", + " {'facts': ['In Croatia, scientists discovered that lampposts were falling down because a chemical in the urine of male dogs was rotting the metal.'],\n", + " 'success': True},\n", + " {'facts': ['President Lyndon Johnson had two beagles named Him and Her.'],\n", + " 'success': True},\n", + " {'facts': ['Dog noses are also very cute and easy to boop.'],\n", + " 'success': True},\n", + " {'facts': ['The Alaskan Malamute can withstand temperatures as low as 70 degrees below zero.'],\n", + " 'success': True},\n", + " {'facts': ['This pup, Nesbit, earned over one million Delta airline miles in his life and had his own frequent flier card.'],\n", + " 'success': True}]" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def request_dog_facts():\n", + " current_day = datetime.now().day\n", + " dogs_facts = []\n", + " for i in range(current_day):\n", + " try: \n", + " res = requests.get(url_for_request).json()\n", + " dogs_facts.append(res)\n", + " except:\n", + " print(\"too many requests, bro\")\n", + " return dogs_facts\n", + "\n", + "dogs_facts = [requests.get(url_for_request).json() for i in range(current_day)]\n", + "dogs_facts" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "813721ac", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[{'facts': ['Male dogs will raise their legs while urinating to aim higher on a tree or lamppost because they want to leave a message that they are tall and intimidating. Some wild dogs in Africa try to run up tree trunks while they are urinating to appear to be very large.'],\n", + " 'success': True},\n", + " {'facts': ['Teams of dogs compete for the fastest time without errors in Flyball races.'],\n", + " 'success': True},\n", + " {'facts': ['During the Middle Ages, mixed breeds of peasants’ dogs were required to wear blocks around their necks to keep them from breeding with noble hunting dogs. Purebred dogs were very expensive and hunting became the province of the rich.'],\n", + " 'success': True},\n", + " {'facts': ['There are nearly 14,000 animal shelters and rescue groups across North America.'],\n", + " 'success': True},\n", + " {'facts': ['Greyhounds appear to be the most ancient dog breed. \"Greyhound\" comes from a mistake in translating the early German name Greishund, which means \"old (or ancient) dog,\" not from the color gray.'],\n", + " 'success': True},\n", + " {'facts': [\"'Frito Feet' is the name of the phenomenon in which the bacteria on a dog's paws cause them to smell like corn chips. Because a pup's feet are in constant contact with the ground, they pick up tons of microorganisms in their paws. When dogs cool off by sweating through the pads of their feet, the combo of moisture and bacteria releaces a nutty, popcorn-like aroma. Basically it's dog B.O.\"],\n", + " 'success': True},\n", + " {'facts': ['Dogs sleep for an average of 10 hours per day.'],\n", + " 'success': True},\n", + " {'facts': ['With love and a little patience, dogs can learn to walk backwards, salute and bow.'],\n", + " 'success': True},\n", + " {'facts': [\"A dog's average body temperature is 101.2 degrees.\"],\n", + " 'success': True},\n", + " {'facts': ['Davy Crockett had a dog named Sport.'], 'success': True},\n", + " {'facts': ['The longer a dog’s nose, the more effective it’s internal cooling system.'],\n", + " 'success': True},\n", + " {'facts': ['It is much easier for dogs to learn spoken commands if they are given in conjunction with hand signals or gestures.'],\n", + " 'success': True},\n", + " {'facts': ['The breed Lundehune has 6 toes and can close its ears.'],\n", + " 'success': True},\n", + " {'facts': ['Rin Tin Tin was the first Hollywood dog star.'], 'success': True},\n", + " {'facts': ['The Boy Scouts and Girl Scouts both offer merit badges in dog care.'],\n", + " 'success': True},\n", + " {'facts': ['The earliest European images of dogs are found in cave paintings dating back 12,000 years ago in Spain.'],\n", + " 'success': True},\n", + " {'facts': ['Dogs who bark the most: Miniature Schnauzers, Cairn Terriers, Yorkshire Terriers, Fox Terriers and West Highland White Terriers.'],\n", + " 'success': True},\n", + " {'facts': ['In addition to \"formal\" forms of dog training (operant conditioning, reinforcement, or classical conditioning), dogs are able to learn merely from observation.'],\n", + " 'success': True},\n", + " {'facts': ['Dogs are natural pack animals.'], 'success': True},\n", + " {'facts': ['Apple and pear seeds contain arsenic, which may be deadly to dogs.'],\n", + " 'success': True},\n", + " {'facts': ['Laika, a Russian stray, was the first living mammal to orbit the Earth, in the Soviet Sputnik spacecraft in 1957. Though she died in space, her daughter Pushnika had four puppies with President John F. Kennedy’s terrier, Charlie.'],\n", + " 'success': True},\n", + " {'facts': ['Gidget is the name of the Taco Bell dog.'], 'success': True},\n", + " {'facts': ['Search and Rescue dog training begin as games played while puppies.'],\n", + " 'success': True},\n", + " {'facts': [\"The wetness of a dog's nose is essential for determining what direction a smell is coming from.\"],\n", + " 'success': True},\n", + " {'facts': ['Humans generally see better than dogs, but dogs see much better when there is low-light.'],\n", + " 'success': True},\n", + " {'facts': ['In Iran, it is against the law to own a dog as a pet. However, if an owner can prove the dog is a guard or hunting dog, this restriction doesn’t apply. Muslim reticence concerning dogs is perhaps due to the fact that rabies has always been endemic in the Middle East.'],\n", + " 'success': True},\n", + " {'facts': ['Dog trainers in ancient China were held in high esteem. A great deal of dog domestication also took place in China, especially dwarfing and miniaturization.'],\n", + " 'success': True}]" + ] + }, + "execution_count": 46, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# Your code here" + "request_dog_facts()" ] }, { @@ -198,12 +492,214 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 57, "id": "d22652ed", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
factssuccess
0[Chocolate contains a substance known as theob...True
1[If never spayed or neutered, a female dog, he...True
2[Touch is the first sense the dog develops. Th...True
3[Pugs and other dogs with short muzzles have a...True
4[Puppies are sometimes rejected by their mothe...True
5[Dogs were first domesticated by cavemen.]True
6[Franklin Roosevelt spent $15,000 for a destro...True
7[Watch that plate of cookies! A Dog’s sense of...True
8[The bible mentions dogs 14 times.]True
9[Dogs with a flesh colored nose is said to hav...True
10[Some stray Russian dogs have figured out how ...True
11[A dog can locate the source of a sound in 1/6...True
12[Dogs have three eyelids, including one to kee...True
13[Dogs normally have between one to sixteen or ...True
14[A dog's average body temperature is 101.2 deg...True
15[Dogs are mentioned in the Bible more than 35 ...True
16[Like human babies, Chihuahuas are born with a...True
17[In 2002 alone, more people in the U.S. were k...True
18[The best dog to reportedly attract a date is ...True
19['Frito Feet' is the name of the phenomenon in...True
20[The Labrador Retriever is the #1 favorite bre...True
21[The oldest known dog bones were found in Asia...True
22[In Croatia, scientists discovered that lamppo...True
23[President Lyndon Johnson had two beagles name...True
24[Dog noses are also very cute and easy to boop.]True
25[The Alaskan Malamute can withstand temperatur...True
26[This pup, Nesbit, earned over one million Del...True
\n", + "
" + ], + "text/plain": [ + " facts success\n", + "0 [Chocolate contains a substance known as theob... True\n", + "1 [If never spayed or neutered, a female dog, he... True\n", + "2 [Touch is the first sense the dog develops. Th... True\n", + "3 [Pugs and other dogs with short muzzles have a... True\n", + "4 [Puppies are sometimes rejected by their mothe... True\n", + "5 [Dogs were first domesticated by cavemen.] True\n", + "6 [Franklin Roosevelt spent $15,000 for a destro... True\n", + "7 [Watch that plate of cookies! A Dog’s sense of... True\n", + "8 [The bible mentions dogs 14 times.] True\n", + "9 [Dogs with a flesh colored nose is said to hav... True\n", + "10 [Some stray Russian dogs have figured out how ... True\n", + "11 [A dog can locate the source of a sound in 1/6... True\n", + "12 [Dogs have three eyelids, including one to kee... True\n", + "13 [Dogs normally have between one to sixteen or ... True\n", + "14 [A dog's average body temperature is 101.2 deg... True\n", + "15 [Dogs are mentioned in the Bible more than 35 ... True\n", + "16 [Like human babies, Chihuahuas are born with a... True\n", + "17 [In 2002 alone, more people in the U.S. were k... True\n", + "18 [The best dog to reportedly attract a date is ... True\n", + "19 ['Frito Feet' is the name of the phenomenon in... True\n", + "20 [The Labrador Retriever is the #1 favorite bre... True\n", + "21 [The oldest known dog bones were found in Asia... True\n", + "22 [In Croatia, scientists discovered that lamppo... True\n", + "23 [President Lyndon Johnson had two beagles name... True\n", + "24 [Dog noses are also very cute and easy to boop.] True\n", + "25 [The Alaskan Malamute can withstand temperatur... True\n", + "26 [This pup, Nesbit, earned over one million Del... True" + ] + }, + "execution_count": 57, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# Your code here" + "df_dogs_facts = pd.DataFrame(dogs_facts)\n", + "df_dogs_facts" ] }, { @@ -216,12 +712,215 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 58, "id": "b29f4826", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
factssuccess
0Chocolate contains a substance known as theobr...True
1If never spayed or neutered, a female dog, her...True
2Touch is the first sense the dog develops. The...True
3Pugs and other dogs with short muzzles have a ...True
4Puppies are sometimes rejected by their mother...True
5Dogs were first domesticated by cavemen.True
6Franklin Roosevelt spent $15,000 for a destroy...True
7Watch that plate of cookies! A Dog’s sense of ...True
8The bible mentions dogs 14 times.True
9Dogs with a flesh colored nose is said to have...True
10Some stray Russian dogs have figured out how t...True
11A dog can locate the source of a sound in 1/60...True
12Dogs have three eyelids, including one to keep...True
13Dogs normally have between one to sixteen or e...True
14A dog's average body temperature is 101.2 degr...True
15Dogs are mentioned in the Bible more than 35 t...True
16Like human babies, Chihuahuas are born with a ...True
17In 2002 alone, more people in the U.S. were ki...True
18The best dog to reportedly attract a date is t...True
19'Frito Feet' is the name of the phenomenon in ...True
20The Labrador Retriever is the #1 favorite bree...True
21The oldest known dog bones were found in Asia ...True
22In Croatia, scientists discovered that lamppos...True
23President Lyndon Johnson had two beagles named...True
24Dog noses are also very cute and easy to boop.True
25The Alaskan Malamute can withstand temperature...True
26This pup, Nesbit, earned over one million Delt...True
\n", + "
" + ], + "text/plain": [ + " facts success\n", + "0 Chocolate contains a substance known as theobr... True\n", + "1 If never spayed or neutered, a female dog, her... True\n", + "2 Touch is the first sense the dog develops. The... True\n", + "3 Pugs and other dogs with short muzzles have a ... True\n", + "4 Puppies are sometimes rejected by their mother... True\n", + "5 Dogs were first domesticated by cavemen. True\n", + "6 Franklin Roosevelt spent $15,000 for a destroy... True\n", + "7 Watch that plate of cookies! A Dog’s sense of ... True\n", + "8 The bible mentions dogs 14 times. True\n", + "9 Dogs with a flesh colored nose is said to have... True\n", + "10 Some stray Russian dogs have figured out how t... True\n", + "11 A dog can locate the source of a sound in 1/60... True\n", + "12 Dogs have three eyelids, including one to keep... True\n", + "13 Dogs normally have between one to sixteen or e... True\n", + "14 A dog's average body temperature is 101.2 degr... True\n", + "15 Dogs are mentioned in the Bible more than 35 t... True\n", + "16 Like human babies, Chihuahuas are born with a ... True\n", + "17 In 2002 alone, more people in the U.S. were ki... True\n", + "18 The best dog to reportedly attract a date is t... True\n", + "19 'Frito Feet' is the name of the phenomenon in ... True\n", + "20 The Labrador Retriever is the #1 favorite bree... True\n", + "21 The oldest known dog bones were found in Asia ... True\n", + "22 In Croatia, scientists discovered that lamppos... True\n", + "23 President Lyndon Johnson had two beagles named... True\n", + "24 Dog noses are also very cute and easy to boop. True\n", + "25 The Alaskan Malamute can withstand temperature... True\n", + "26 This pup, Nesbit, earned over one million Delt... True" + ] + }, + "execution_count": 58, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# Your code here" + "#df_dogs_facts = df_dogs_facts.apply(Percentage = lambda x: (x['Total_Marks'] /500 * 100))\n", + "df_dogs_facts[\"facts\"] = df_dogs_facts[\"facts\"].apply(lambda x: ''.join(x))\n", + "df_dogs_facts" ] }, { @@ -242,13 +941,42 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 59, "id": "ca21a372", "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'C:\\\\Users\\\\mocid\\\\Ironhack\\\\labs\\\\lab-apis\\\\your-code'" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pwd" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "id": "c5892f84", + "metadata": {}, "outputs": [], "source": [ - "# Your code here" + "df_dogs_facts.to_csv('.\\dogs_facts_dataframe.csv', index=False)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4e9c44bd", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -267,7 +995,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.5" + "version": "3.11.4" }, "nbTranslate": { "displayLangs": [ diff --git a/your-code/dogs_facts_dataframe.csv b/your-code/dogs_facts_dataframe.csv new file mode 100644 index 0000000..f15a29f --- /dev/null +++ b/your-code/dogs_facts_dataframe.csv @@ -0,0 +1,28 @@ +facts,success +"Chocolate contains a substance known as theobromine (similar to caffeine) which can kill dogs or, at the very least, make them violently ill.",True +"If never spayed or neutered, a female dog, her mate, and their puppies could produce over 66,000 dogs in 6 years!",True +"Touch is the first sense the dog develops. The entire body, including the paws, is covered with touch-sensitive nerve endings.",True +"Pugs and other dogs with short muzzles have a peculiar head-type known as ""Brachycephalic.""",True +Puppies are sometimes rejected by their mother if they are born by cesarean and cleaned up before being given back to her.,True +Dogs were first domesticated by cavemen.,True +"Franklin Roosevelt spent $15,000 for a destroyer to pick up his Scottie in the Aleutian Islands.",True +"Watch that plate of cookies! A Dog’s sense of smell is 10,000 – 100,000 times more acute as that of humans.",True +The bible mentions dogs 14 times.,True +"Dogs with a flesh colored nose is said to have a ""Dudley Nose.""",True +Some stray Russian dogs have figured out how to use the subway system in order to travel to more populated areas in search of food.,True +A dog can locate the source of a sound in 1/600 of a second and can hear sounds four times farther away than a human can.,True +"Dogs have three eyelids, including one to keep their eyes moist and protected.",True +Dogs normally have between one to sixteen or even more puppies.,True +A dog's average body temperature is 101.2 degrees.,True +Dogs are mentioned in the Bible more than 35 times.,True +"Like human babies, Chihuahuas are born with a soft spot in their skull which closes with age.",True +"In 2002 alone, more people in the U.S. were killed by dogs than by sharks in the past 100 years.",True +The best dog to reportedly attract a date is the Golden Retriever. The worst is the Pit Bull.,True +"'Frito Feet' is the name of the phenomenon in which the bacteria on a dog's paws cause them to smell like corn chips. Because a pup's feet are in constant contact with the ground, they pick up tons of microorganisms in their paws. When dogs cool off by sweating through the pads of their feet, the combo of moisture and bacteria releaces a nutty, popcorn-like aroma. Basically it's dog B.O.",True +"The Labrador Retriever is the #1 favorite breed in the U.S., Canada, and the U.K.",True +"The oldest known dog bones were found in Asia and date as far back as 10,000 B.C. The first identifiable dog breed appeared about 9000 B.C. and was probably a type of Greyhound dog used for hunting.",True +"In Croatia, scientists discovered that lampposts were falling down because a chemical in the urine of male dogs was rotting the metal.",True +President Lyndon Johnson had two beagles named Him and Her.,True +Dog noses are also very cute and easy to boop.,True +The Alaskan Malamute can withstand temperatures as low as 70 degrees below zero.,True +"This pup, Nesbit, earned over one million Delta airline miles in his life and had his own frequent flier card.",True