{ "cells": [ { "cell_type": "markdown", "id": "9e0b4e60", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# DS2500 Day 21\n", "\n", "Mar 31, 2023\n", "\n", "### Content\n", "- Weather API\n", " - timestamps\n", " - representing a tree via nested dictionaries (json format)\n", " - making API calls\n", "- 🐂💩 visualizations\n", " - the colorful language, [it isn't mine](https://www.callingbullshit.org/), though it does add a certain excitement to our ordinarily dry technical lingo\n", "\n", "### Admin\n", "- focus on the project!\n", " - presentatoin preferences due next monday @ 9AM\n", " - https://piazza.com/class/lbxsbawi9yq2f9/post/403\n", " - lab sessions next week will support hw7\n", " - its optional, no need to go if you don't feel the need\n", " - hw7 is due next monday (April 3) to allow you to ask questions in lab\n", "\n", " - no classes next week, sign up for a project team meeting with Prof Higger\n", " - link on course website" ] }, { "cell_type": "markdown", "id": "870b0ff1", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Timestamps\n", "## Unix Time\n", "\n", "- [UTC 00:00](https://en.wikipedia.org/wiki/UTC%2B00:00) Coordinated Universal Time's \"zero\" timezome\n", " - time zone at 0 deg longitude\n", " - how is 0 deg longitude defined? \n", " - A succesfully warring empire (United Kingdom) chose it \n", " - (personally, I'd find it convenient if a metric system loving empire had been more successful at war ...)\n", "- [Unix Time](https://en.wikipedia.org/wiki/Unix_time) is The number of seconds which have passed since 00:00:00 UTC on 1 Jan 1970 (ignoring leap seconds)\n", "- UTC is time zone agnostic \n", " - (more on this next lesson...)\n", "\n", "## Python's `datetime` & `timedelta`\n", "- helpful for all those pesky unit conversions" ] }, { "cell_type": "code", "execution_count": 1, "id": "5adc58fc", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "datetime.datetime(2021, 2, 14, 2, 0)" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from datetime import datetime, timedelta\n", "\n", "utc_example = 1613286000\n", "\n", "# WARNING! assumes the time zone of the machine its running on!\n", "# (we'll see this issue again later ...)\n", "dt0 = datetime.fromtimestamp(utc_example)\n", "dt0" ] }, { "cell_type": "markdown", "id": "55cbacb4", "metadata": {}, "source": [ "[further reading](https://docs.python.org/3/library/datetime.html#aware-and-naive-objects) on the datetime above being timezone agnostic." ] }, { "cell_type": "code", "execution_count": 3, "id": "94556cf9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(2, 14)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# we can access meaningful date attributes of a datetime object\n", "# year, month, day, hour, minute, second\n", "dt0.month, dt0.day" ] }, { "cell_type": "code", "execution_count": 10, "id": "faf7f937", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "datetime.datetime(2023, 3, 31, 15, 52, 33, 44509)" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dt1 = datetime.now()\n", "dt1" ] }, { "cell_type": "code", "execution_count": 11, "id": "3ee738bf", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "datetime.datetime(2222, 2, 2, 2, 22, 22)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dt2 = datetime(year=2222, month=2, day=2, hour=2, minute=22, second=22)\n", "dt2" ] }, { "cell_type": "code", "execution_count": 12, "id": "87f7c545", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "datetime.timedelta(days=72625, seconds=37788, microseconds=955491)" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# time delta measure differences between two datetimes:\n", "dt2 - dt1" ] }, { "cell_type": "code", "execution_count": 13, "id": "d924614d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "datetime.timedelta(days=3, seconds=37056)" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# you can build them explicitly:\n", "offset = timedelta(days=2, seconds=123456)\n", "offset" ] }, { "cell_type": "code", "execution_count": 15, "id": "e2e6b617", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "datetime.datetime(2222, 2, 5, 12, 39, 58)" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# and operate with them (datetime + timedelta = datetime)\n", "dt2 + offset" ] }, { "cell_type": "code", "execution_count": 17, "id": "12d15e2f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "733593284.490704" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# how many seconds old are you?\n", "(datetime.now() - datetime(year=2000, month=1, day=1)).total_seconds()" ] }, { "cell_type": "code", "execution_count": 18, "id": "0de30b1c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "31.70958904109589" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# you've got a billionth second birthday coming up around age 31 or so:\n", "billion_sec = timedelta(seconds=1e9)\n", "billion_sec.days / 365" ] }, { "cell_type": "code", "execution_count": 11, "id": "91dea7a1", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "datetime.datetime(2031, 9, 9, 1, 46, 40)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# be sure to compute below so you can plan that party 10 years from now\n", "datetime(year=2000, month=1, day=1) + billion_sec" ] }, { "cell_type": "markdown", "id": "3f25eeaf", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# `pd.to_datetime()`\n", "\n", "Use pandas's [pd.to_datetime()](https://pandas.pydata.org/docs/reference/api/pandas.to_datetime.html) function to convert a column of your dataframe to datetime objects. \n", "\n", "`to_datetime()` does a pretty good job guessing your format, but if it runs into trouble you've always got [strftime & strptime](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior)" ] }, { "cell_type": "code", "execution_count": 19, "id": "df2bca22", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 dec 23, 2000\n", "1 jan 1, 2039 3AM\n", "2 jan 14, 2039 14:00\n", "3 not reallysakdjfaposdiufpsaid8yfa time\n", "dtype: object" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "\n", "s = pd.Series(['dec 23, 2000', 'jan 1, 2039 3AM', 'jan 14, 2039 14:00', 'not reallysakdjfaposdiufpsaid8yfa time'])\n", "\n", "s" ] }, { "cell_type": "code", "execution_count": 22, "id": "7ec7f28f", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 2000-12-23 00:00:00\n", "1 2039-01-01 03:00:00\n", "2 2039-01-14 14:00:00\n", "3 NaT\n", "dtype: datetime64[ns]" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# the errors = 'coerce' argument yield \"NaT\", not-a-time, objects for inputs which\n", "# can't be converted. without this generates an error\n", "pd.to_datetime(s, errors='coerce')" ] }, { "cell_type": "markdown", "id": "8e969b4b", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Do you know what time it is?\n", "[after reading this, I'm not sure that I do ...](https://www.creativedeletion.com/2015/01/28/falsehoods-programmers-date-time-zones.html)\n", "\n", "takeaways:\n", "- don't underestimate the difficulty of describing time unabmiguously, its hard!\n", "- use a library where you might run into time issues:\n", " - timezones\n", " - leap year / second\n", " - varying days of month / year\n", " - time formatting 'Feb' vs 'February' etc\n", "- Unix Time isn't human readable ... but it is unambiguous. \n", "\n", "### Punchline: measuring time is hard, don't underestimate it (I certainly have!)" ] }, { "cell_type": "markdown", "id": "dbf0b3e4", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Representing Trees as Lists & Dictionaries\n", "- useful for representing a tree of data\n", "- (our API calls will return nested dictionaries)\n", "\n", "\"Drawing\"" ] }, { "cell_type": "code", "execution_count": 27, "id": "6e85312e", "metadata": {}, "outputs": [], "source": [ "red_branch_dict = {'a': 0, 'b': 1, 'c': 2}" ] }, { "cell_type": "code", "execution_count": 28, "id": "b2459e96", "metadata": {}, "outputs": [], "source": [ "blu_branch_dict = {'x': 24, 'y': 25, 'z': 26}" ] }, { "cell_type": "code", "execution_count": 29, "id": "a917657b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'f': {'a': 0, 'b': 1, 'c': 2}, 'g': {'x': 24, 'y': 25, 'z': 26}}" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "tree_dict = {'f': red_branch_dict,\n", " 'g': blu_branch_dict}\n", "tree_dict" ] }, { "cell_type": "code", "execution_count": 31, "id": "f131240a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "tree_dict['f']['b']" ] }, { "cell_type": "markdown", "id": "4f999d34", "metadata": {}, "source": [ "\"Drawing\"" ] }, { "cell_type": "code", "execution_count": 33, "id": "d9da95c0", "metadata": {}, "outputs": [], "source": [ "dict0 = {'num': 14,\n", " 'letter': 'C'}\n", "dict1 = {'num': 17,\n", " 'letter': 'R'}\n", "dict2 = {'num': 21,\n", " 'letter': 'S'}\n", "\n", "dict_of_dict = {0: dict0,\n", " 1: dict1,\n", " 2: dict2}" ] }, { "cell_type": "code", "execution_count": 34, "id": "86de63b4", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "'C'" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dict_of_dict[0]['letter']" ] }, { "cell_type": "code", "execution_count": 37, "id": "140088ac", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "14" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "list_of_dict[0]['num']" ] }, { "cell_type": "markdown", "id": "93046c6d", "metadata": {}, "source": [ "## In class activity 1:\n", "1. Express all of the following penguin group's height and weight as a list of dictionaries:\n", "\"Drawing\"" ] }, { "cell_type": "code", "execution_count": 39, "id": "23b75bcf", "metadata": {}, "outputs": [], "source": [ "grn_dict = {'height': [2, 3, 2],\n", " 'weight': [4, 6, 5]}\n", "blu_dict = {'height': [4, 6, 5],\n", " 'weight': [2, 3, 2]}\n", "red_dict = {'height': [10, 7, 8],\n", " 'weight': [11, 6, 5]}\n", "peng_data = [grn_dict,\n", " blu_dict,\n", " red_dict]" ] }, { "cell_type": "code", "execution_count": 42, "id": "9adc4397", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# what is the height of the last penguin0?\n", "peng_data[0]['height'][-1]" ] }, { "cell_type": "markdown", "id": "5839a432", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# API\n", "### Definitions\n", "**API** Application Program Interface\n", " - within DS: a server which gives out data (often over the internet)\n", " - note: 'API', in general, refers to the barrier between two pieces of software, has a specific meaning in DS\n", " \n", " \n", " **JSON** JavaScript Object Notation\n", " - a method of storing objects as text\n", " - much like the nested dictionaries ... JSON and similar formats are often trees" ] }, { "cell_type": "markdown", "id": "29264c73", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## OpenWeather API\n", "What information does this offer?\n", "\n", "- [https://openweathermap.org/api](https://openweathermap.org/api)\n", "- (note, you won't have access to all that, see the \"free\" column [here](https://openweathermap.org/price))\n", "\n", "How do I get ready to use it?\n", "- sign up for an account\n", " - [https://home.openweathermap.org/users/sign_up](https://home.openweathermap.org/users/sign_up)\n", "- get an api key\n", " - [https://home.openweathermap.org/api_keys](https://home.openweathermap.org/api_keys)\n", " \n", "Think of APIs as a hybrid of a website and a function. Its a website where your query is stored in the address:" ] }, { "cell_type": "code", "execution_count": 23, "id": "ddf57001", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "https://api.openweathermap.org/data/2.5/forecast?lat=42.3601&lon=-71.0589&units=imperial&appid=eea5fcef9a7ea19505dc1c165bacac4a\n" ] } ], "source": [ "api_key = 'eea5fcef9a7ea19505dc1c165bacac4a'\n", "\n", "# north = positive, south = negative\n", "lat = 42.3601\n", "# west = positive, east = negative\n", "lon = -71.0589\n", "\n", "units = 'imperial'\n", "\n", "url = f'https://api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&units={units}&appid={api_key}'\n", "print(url)" ] }, { "cell_type": "code", "execution_count": 43, "id": "1d51a6ed", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "'{\"cod\":\"200\",\"message\":0,\"cnt\":40,\"list\":[{\"dt\":1680296400,\"main\":{\"temp\":47.37,\"feels_like\":42.04,\"temp_min\":46.42,\"temp_max\":47.37,\"pressure\":1020,\"sea_level\":1020,\"grnd_level\":1020,\"humidity\":45,\"temp_kf\":0.53},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":12.24,\"deg\":190,\"gust\":19.26},\"visibility\":10000,\"pop\":0.02,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-03-31 21:00:00\"},{\"dt\":1680307200,\"main\":{\"temp\":44.46,\"feels_like\":39.24,\"temp_min\":38.62,\"temp_max\":44.46,\"pressure\":1020,\"sea_level\":1020,\"grnd_level\":1019,\"humidity\":59,\"temp_kf\":3.24},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":9.82,\"deg\":160,\"gust\":26.66},\"visibility\":6644,\"pop\":0.92,\"rain\":{\"3h\":2.47},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-01 00:00:00\"},{\"dt\":1680318000,\"main\":{\"temp\":43.47,\"feels_like\":38.66,\"temp_min\":41.52,\"temp_max\":43.47,\"pressure\":1017,\"sea_level\":1017,\"grnd_level\":1015,\"humidity\":78,\"temp_kf\":1.08},\"weather\":[{\"id\":501,\"main\":\"Rain\",\"description\":\"moderate rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":8.32,\"deg\":152,\"gust\":25.01},\"visibility\":10000,\"pop\":1,\"rain\":{\"3h\":5.55},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-01 03:00:00\"},{\"dt\":1680328800,\"main\":{\"temp\":43.05,\"feels_like\":43.05,\"temp_min\":43.05,\"temp_max\":43.05,\"pressure\":1011,\"sea_level\":1011,\"grnd_level\":1011,\"humidity\":99,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":1.86,\"deg\":260,\"gust\":7.43},\"visibility\":10000,\"pop\":1,\"rain\":{\"3h\":1.45},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-01 06:00:00\"},{\"dt\":1680339600,\"main\":{\"temp\":42.21,\"feels_like\":42.21,\"temp_min\":42.21,\"temp_max\":42.21,\"pressure\":1008,\"sea_level\":1008,\"grnd_level\":1008,\"humidity\":98,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":1.28,\"deg\":280,\"gust\":3.09},\"visibility\":7999,\"pop\":0.25,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-01 09:00:00\"},{\"dt\":1680350400,\"main\":{\"temp\":44.31,\"feels_like\":42.04,\"temp_min\":44.31,\"temp_max\":44.31,\"pressure\":1003,\"sea_level\":1003,\"grnd_level\":1003,\"humidity\":99,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":4.32,\"deg\":140,\"gust\":15.05},\"visibility\":742,\"pop\":1,\"rain\":{\"3h\":1.61},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-01 12:00:00\"},{\"dt\":1680361200,\"main\":{\"temp\":50.61,\"feels_like\":49.93,\"temp_min\":50.61,\"temp_max\":50.61,\"pressure\":1000,\"sea_level\":1000,\"grnd_level\":999,\"humidity\":97,\"temp_kf\":0},\"weather\":[{\"id\":501,\"main\":\"Rain\",\"description\":\"moderate rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":9.89,\"deg\":212,\"gust\":33.22},\"visibility\":10000,\"pop\":1,\"rain\":{\"3h\":3.45},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-01 15:00:00\"},{\"dt\":1680372000,\"main\":{\"temp\":56.84,\"feels_like\":56.5,\"temp_min\":56.84,\"temp_max\":56.84,\"pressure\":996,\"sea_level\":996,\"grnd_level\":995,\"humidity\":91,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":16.17,\"deg\":218,\"gust\":38.83},\"visibility\":10000,\"pop\":1,\"rain\":{\"3h\":0.47},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-01 18:00:00\"},{\"dt\":1680382800,\"main\":{\"temp\":56.89,\"feels_like\":56.55,\"temp_min\":56.89,\"temp_max\":56.89,\"pressure\":993,\"sea_level\":993,\"grnd_level\":993,\"humidity\":91,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10d\"}],\"clouds\":{\"all\":99},\"wind\":{\"speed\":11.77,\"deg\":212,\"gust\":27.29},\"visibility\":10000,\"pop\":0.64,\"rain\":{\"3h\":0.37},\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-01 21:00:00\"},{\"dt\":1680393600,\"main\":{\"temp\":53.47,\"feels_like\":52.99,\"temp_min\":53.47,\"temp_max\":53.47,\"pressure\":992,\"sea_level\":992,\"grnd_level\":991,\"humidity\":95,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":75},\"wind\":{\"speed\":9.84,\"deg\":202,\"gust\":27.67},\"visibility\":10000,\"pop\":0.53,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-02 00:00:00\"},{\"dt\":1680404400,\"main\":{\"temp\":52.09,\"feels_like\":51.37,\"temp_min\":52.09,\"temp_max\":52.09,\"pressure\":990,\"sea_level\":990,\"grnd_level\":989,\"humidity\":93,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":92},\"wind\":{\"speed\":7.87,\"deg\":275,\"gust\":20.29},\"visibility\":10000,\"pop\":0.97,\"rain\":{\"3h\":2.43},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-02 03:00:00\"},{\"dt\":1680415200,\"main\":{\"temp\":49.12,\"feels_like\":43.63,\"temp_min\":49.12,\"temp_max\":49.12,\"pressure\":990,\"sea_level\":990,\"grnd_level\":990,\"humidity\":81,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":96},\"wind\":{\"speed\":14.56,\"deg\":283,\"gust\":30.04},\"visibility\":10000,\"pop\":1,\"rain\":{\"3h\":1.06},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-02 06:00:00\"},{\"dt\":1680426000,\"main\":{\"temp\":45.54,\"feels_like\":38.46,\"temp_min\":45.54,\"temp_max\":45.54,\"pressure\":995,\"sea_level\":995,\"grnd_level\":995,\"humidity\":74,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":98},\"wind\":{\"speed\":16.84,\"deg\":310,\"gust\":33.69},\"visibility\":10000,\"pop\":0.24,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-02 09:00:00\"},{\"dt\":1680436800,\"main\":{\"temp\":38.35,\"feels_like\":29.32,\"temp_min\":38.35,\"temp_max\":38.35,\"pressure\":1003,\"sea_level\":1003,\"grnd_level\":1003,\"humidity\":63,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":57},\"wind\":{\"speed\":16.35,\"deg\":312,\"gust\":34.72},\"visibility\":10000,\"pop\":0.13,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-02 12:00:00\"},{\"dt\":1680447600,\"main\":{\"temp\":39.78,\"feels_like\":30.56,\"temp_min\":39.78,\"temp_max\":39.78,\"pressure\":1008,\"sea_level\":1008,\"grnd_level\":1007,\"humidity\":35,\"temp_kf\":0},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01d\"}],\"clouds\":{\"all\":5},\"wind\":{\"speed\":18.52,\"deg\":327,\"gust\":29.51},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-02 15:00:00\"},{\"dt\":1680458400,\"main\":{\"temp\":42.89,\"feels_like\":35.4,\"temp_min\":42.89,\"temp_max\":42.89,\"pressure\":1011,\"sea_level\":1011,\"grnd_level\":1011,\"humidity\":28,\"temp_kf\":0},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01d\"}],\"clouds\":{\"all\":3},\"wind\":{\"speed\":15.46,\"deg\":329,\"gust\":22.39},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-02 18:00:00\"},{\"dt\":1680469200,\"main\":{\"temp\":42.84,\"feels_like\":36.01,\"temp_min\":42.84,\"temp_max\":42.84,\"pressure\":1014,\"sea_level\":1014,\"grnd_level\":1013,\"humidity\":30,\"temp_kf\":0},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01d\"}],\"clouds\":{\"all\":0},\"wind\":{\"speed\":13.2,\"deg\":326,\"gust\":18.54},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-02 21:00:00\"},{\"dt\":1680480000,\"main\":{\"temp\":37.81,\"feels_like\":30.69,\"temp_min\":37.81,\"temp_max\":37.81,\"pressure\":1018,\"sea_level\":1018,\"grnd_level\":1017,\"humidity\":37,\"temp_kf\":0},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01n\"}],\"clouds\":{\"all\":0},\"wind\":{\"speed\":10.56,\"deg\":326,\"gust\":20.27},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-03 00:00:00\"},{\"dt\":1680490800,\"main\":{\"temp\":34.27,\"feels_like\":27.72,\"temp_min\":34.27,\"temp_max\":34.27,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":1019,\"humidity\":38,\"temp_kf\":0},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01n\"}],\"clouds\":{\"all\":7},\"wind\":{\"speed\":7.81,\"deg\":332,\"gust\":18.66},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-03 03:00:00\"},{\"dt\":1680501600,\"main\":{\"temp\":32.79,\"feels_like\":29.97,\"temp_min\":32.79,\"temp_max\":32.79,\"pressure\":1020,\"sea_level\":1020,\"grnd_level\":1019,\"humidity\":38,\"temp_kf\":0},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01n\"}],\"clouds\":{\"all\":8},\"wind\":{\"speed\":3.18,\"deg\":313,\"gust\":6.35},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-03 06:00:00\"},{\"dt\":1680512400,\"main\":{\"temp\":32.43,\"feels_like\":29.48,\"temp_min\":32.43,\"temp_max\":32.43,\"pressure\":1021,\"sea_level\":1021,\"grnd_level\":1020,\"humidity\":41,\"temp_kf\":0},\"weather\":[{\"id\":800,\"main\":\"Clear\",\"description\":\"clear sky\",\"icon\":\"01n\"}],\"clouds\":{\"all\":9},\"wind\":{\"speed\":3.24,\"deg\":190,\"gust\":5.97},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-03 09:00:00\"},{\"dt\":1680523200,\"main\":{\"temp\":35.71,\"feels_like\":29.8,\"temp_min\":35.71,\"temp_max\":35.71,\"pressure\":1022,\"sea_level\":1022,\"grnd_level\":1021,\"humidity\":44,\"temp_kf\":0},\"weather\":[{\"id\":801,\"main\":\"Clouds\",\"description\":\"few clouds\",\"icon\":\"02d\"}],\"clouds\":{\"all\":12},\"wind\":{\"speed\":7.25,\"deg\":202,\"gust\":15.46},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-03 12:00:00\"},{\"dt\":1680534000,\"main\":{\"temp\":46.6,\"feels_like\":41.43,\"temp_min\":46.6,\"temp_max\":46.6,\"pressure\":1019,\"sea_level\":1019,\"grnd_level\":1019,\"humidity\":35,\"temp_kf\":0},\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"broken clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":84},\"wind\":{\"speed\":11.1,\"deg\":208,\"gust\":17.92},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-03 15:00:00\"},{\"dt\":1680544800,\"main\":{\"temp\":54.01,\"feels_like\":50.61,\"temp_min\":54.01,\"temp_max\":54.01,\"pressure\":1016,\"sea_level\":1016,\"grnd_level\":1015,\"humidity\":32,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":91},\"wind\":{\"speed\":14.76,\"deg\":211,\"gust\":24.83},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-03 18:00:00\"},{\"dt\":1680555600,\"main\":{\"temp\":52.66,\"feels_like\":49.55,\"temp_min\":52.66,\"temp_max\":52.66,\"pressure\":1013,\"sea_level\":1013,\"grnd_level\":1012,\"humidity\":41,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":14.79,\"deg\":209,\"gust\":32.48},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-03 21:00:00\"},{\"dt\":1680566400,\"main\":{\"temp\":49.08,\"feels_like\":43.61,\"temp_min\":49.08,\"temp_max\":49.08,\"pressure\":1012,\"sea_level\":1012,\"grnd_level\":1012,\"humidity\":59,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":90},\"wind\":{\"speed\":14.45,\"deg\":214,\"gust\":39.86},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-04 00:00:00\"},{\"dt\":1680577200,\"main\":{\"temp\":48.43,\"feels_like\":44.82,\"temp_min\":48.43,\"temp_max\":48.43,\"pressure\":1014,\"sea_level\":1014,\"grnd_level\":1014,\"humidity\":74,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":94},\"wind\":{\"speed\":8.1,\"deg\":265,\"gust\":22.64},\"visibility\":10000,\"pop\":0.2,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-04 03:00:00\"},{\"dt\":1680588000,\"main\":{\"temp\":46.44,\"feels_like\":46.44,\"temp_min\":46.44,\"temp_max\":46.44,\"pressure\":1015,\"sea_level\":1015,\"grnd_level\":1014,\"humidity\":87,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":97},\"wind\":{\"speed\":2.73,\"deg\":197,\"gust\":4.18},\"visibility\":10000,\"pop\":0.49,\"rain\":{\"3h\":0.51},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-04 06:00:00\"},{\"dt\":1680598800,\"main\":{\"temp\":46.38,\"feels_like\":44.44,\"temp_min\":46.38,\"temp_max\":46.38,\"pressure\":1014,\"sea_level\":1014,\"grnd_level\":1014,\"humidity\":87,\"temp_kf\":0},\"weather\":[{\"id\":500,\"main\":\"Rain\",\"description\":\"light rain\",\"icon\":\"10n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":4.34,\"deg\":195,\"gust\":10.16},\"visibility\":10000,\"pop\":0.3,\"rain\":{\"3h\":0.1},\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-04 09:00:00\"},{\"dt\":1680609600,\"main\":{\"temp\":47.7,\"feels_like\":46.6,\"temp_min\":47.7,\"temp_max\":47.7,\"pressure\":1016,\"sea_level\":1016,\"grnd_level\":1015,\"humidity\":86,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":3.51,\"deg\":210,\"gust\":6.85},\"visibility\":10000,\"pop\":0.11,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-04 12:00:00\"},{\"dt\":1680620400,\"main\":{\"temp\":55.44,\"feels_like\":53.87,\"temp_min\":55.44,\"temp_max\":55.44,\"pressure\":1016,\"sea_level\":1016,\"grnd_level\":1016,\"humidity\":68,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":2.33,\"deg\":230,\"gust\":4.14},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-04 15:00:00\"},{\"dt\":1680631200,\"main\":{\"temp\":58.42,\"feels_like\":56.93,\"temp_min\":58.42,\"temp_max\":58.42,\"pressure\":1016,\"sea_level\":1016,\"grnd_level\":1016,\"humidity\":63,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":2.15,\"deg\":90,\"gust\":2.28},\"visibility\":10000,\"pop\":0.08,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-04 18:00:00\"},{\"dt\":1680642000,\"main\":{\"temp\":56.84,\"feels_like\":55.47,\"temp_min\":56.84,\"temp_max\":56.84,\"pressure\":1018,\"sea_level\":1018,\"grnd_level\":1018,\"humidity\":69,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":5.44,\"deg\":67,\"gust\":6.91},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-04 21:00:00\"},{\"dt\":1680652800,\"main\":{\"temp\":51.75,\"feels_like\":50.29,\"temp_min\":51.75,\"temp_max\":51.75,\"pressure\":1021,\"sea_level\":1021,\"grnd_level\":1020,\"humidity\":78,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":4.68,\"deg\":104,\"gust\":8.59},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-05 00:00:00\"},{\"dt\":1680663600,\"main\":{\"temp\":50.2,\"feels_like\":48.72,\"temp_min\":50.2,\"temp_max\":50.2,\"pressure\":1022,\"sea_level\":1022,\"grnd_level\":1022,\"humidity\":81,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":99},\"wind\":{\"speed\":3.42,\"deg\":110,\"gust\":6.67},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-05 03:00:00\"},{\"dt\":1680674400,\"main\":{\"temp\":49.17,\"feels_like\":48.13,\"temp_min\":49.17,\"temp_max\":49.17,\"pressure\":1022,\"sea_level\":1022,\"grnd_level\":1022,\"humidity\":87,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":3.71,\"deg\":93,\"gust\":7.56},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-05 06:00:00\"},{\"dt\":1680685200,\"main\":{\"temp\":47.48,\"feels_like\":46.09,\"temp_min\":47.48,\"temp_max\":47.48,\"pressure\":1023,\"sea_level\":1023,\"grnd_level\":1022,\"humidity\":92,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04n\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":3.83,\"deg\":70,\"gust\":7.54},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"n\"},\"dt_txt\":\"2023-04-05 09:00:00\"},{\"dt\":1680696000,\"main\":{\"temp\":47.35,\"feels_like\":44.92,\"temp_min\":47.35,\"temp_max\":47.35,\"pressure\":1023,\"sea_level\":1023,\"grnd_level\":1023,\"humidity\":91,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":5.3,\"deg\":83,\"gust\":11.92},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-05 12:00:00\"},{\"dt\":1680706800,\"main\":{\"temp\":51.48,\"feels_like\":50.36,\"temp_min\":51.48,\"temp_max\":51.48,\"pressure\":1023,\"sea_level\":1023,\"grnd_level\":1022,\"humidity\":86,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":5.57,\"deg\":107,\"gust\":10.04},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-05 15:00:00\"},{\"dt\":1680717600,\"main\":{\"temp\":53.19,\"feels_like\":52.29,\"temp_min\":53.19,\"temp_max\":53.19,\"pressure\":1020,\"sea_level\":1020,\"grnd_level\":1019,\"humidity\":87,\"temp_kf\":0},\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"overcast clouds\",\"icon\":\"04d\"}],\"clouds\":{\"all\":100},\"wind\":{\"speed\":4.9,\"deg\":107,\"gust\":9.69},\"visibility\":10000,\"pop\":0,\"sys\":{\"pod\":\"d\"},\"dt_txt\":\"2023-04-05 18:00:00\"}],\"city\":{\"id\":4930956,\"name\":\"Boston\",\"coord\":{\"lat\":42.3601,\"lon\":-71.0589},\"country\":\"US\",\"population\":617594,\"timezone\":-14400,\"sunrise\":1680258525,\"sunset\":1680304072}}'" ] }, "execution_count": 43, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import requests\n", "\n", "# get url as a string\n", "url_text = requests.get(url).text \n", "url_text" ] }, { "cell_type": "markdown", "id": "5e6ef615", "metadata": {}, "source": [ "The resulting JSON object is a dictionary of dictionaries (or a list of dictionaries) tree as seen in the previous section.\n", "\n", "You can convert it from string to dicts and lists via:" ] }, { "cell_type": "code", "execution_count": 48, "id": "7fe29f4b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'dt': 1680296400,\n", " 'main': {'temp': 47.37,\n", " 'feels_like': 42.04,\n", " 'temp_min': 46.42,\n", " 'temp_max': 47.37,\n", " 'pressure': 1020,\n", " 'sea_level': 1020,\n", " 'grnd_level': 1020,\n", " 'humidity': 45,\n", " 'temp_kf': 0.53},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 12.24, 'deg': 190, 'gust': 19.26},\n", " 'visibility': 10000,\n", " 'pop': 0.02,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-03-31 21:00:00'}" ] }, "execution_count": 48, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import json\n", "\n", "# convert json to a nested dict\n", "weather_dict = json.loads(url_text)\n", "\n", "weather_dict['list'][0]" ] }, { "cell_type": "code", "execution_count": 22, "id": "aa60c358", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "[{'dt': 1680264000,\n", " 'main': {'temp': 28.09,\n", " 'feels_like': 21.51,\n", " 'temp_min': 28.09,\n", " 'temp_max': 33.62,\n", " 'pressure': 1027,\n", " 'sea_level': 1027,\n", " 'grnd_level': 1027,\n", " 'humidity': 61,\n", " 'temp_kf': -3.07},\n", " 'weather': [{'id': 801,\n", " 'main': 'Clouds',\n", " 'description': 'few clouds',\n", " 'icon': '02d'}],\n", " 'clouds': {'all': 17},\n", " 'wind': {'speed': 6.08, 'deg': 258, 'gust': 10.69},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-03-31 12:00:00'},\n", " {'dt': 1680274800,\n", " 'main': {'temp': 33.33,\n", " 'feels_like': 27.72,\n", " 'temp_min': 33.33,\n", " 'temp_max': 43.79,\n", " 'pressure': 1027,\n", " 'sea_level': 1027,\n", " 'grnd_level': 1026,\n", " 'humidity': 49,\n", " 'temp_kf': -5.81},\n", " 'weather': [{'id': 802,\n", " 'main': 'Clouds',\n", " 'description': 'scattered clouds',\n", " 'icon': '03d'}],\n", " 'clouds': {'all': 41},\n", " 'wind': {'speed': 6.13, 'deg': 242, 'gust': 11.68},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-03-31 15:00:00'},\n", " {'dt': 1680285600,\n", " 'main': {'temp': 43.2,\n", " 'feels_like': 39.09,\n", " 'temp_min': 43.2,\n", " 'temp_max': 50.76,\n", " 'pressure': 1024,\n", " 'sea_level': 1024,\n", " 'grnd_level': 1022,\n", " 'humidity': 39,\n", " 'temp_kf': -4.2},\n", " 'weather': [{'id': 803,\n", " 'main': 'Clouds',\n", " 'description': 'broken clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 68},\n", " 'wind': {'speed': 6.8, 'deg': 215, 'gust': 13.91},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-03-31 18:00:00'},\n", " {'dt': 1680296400,\n", " 'main': {'temp': 41.9,\n", " 'feels_like': 35.31,\n", " 'temp_min': 41.9,\n", " 'temp_max': 41.9,\n", " 'pressure': 1020,\n", " 'sea_level': 1020,\n", " 'grnd_level': 1020,\n", " 'humidity': 70,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 500,\n", " 'main': 'Rain',\n", " 'description': 'light rain',\n", " 'icon': '10d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 11.77, 'deg': 192, 'gust': 20.71},\n", " 'visibility': 10000,\n", " 'pop': 0.47,\n", " 'rain': {'3h': 0.45},\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-03-31 21:00:00'},\n", " {'dt': 1680307200,\n", " 'main': {'temp': 40.28,\n", " 'feels_like': 33.64,\n", " 'temp_min': 40.28,\n", " 'temp_max': 40.28,\n", " 'pressure': 1017,\n", " 'sea_level': 1017,\n", " 'grnd_level': 1017,\n", " 'humidity': 84,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 501,\n", " 'main': 'Rain',\n", " 'description': 'moderate rain',\n", " 'icon': '10n'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 10.85, 'deg': 164, 'gust': 30.85},\n", " 'visibility': 9087,\n", " 'pop': 0.96,\n", " 'rain': {'3h': 3.52},\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-01 00:00:00'},\n", " {'dt': 1680318000,\n", " 'main': {'temp': 44.58,\n", " 'feels_like': 41.49,\n", " 'temp_min': 44.58,\n", " 'temp_max': 44.58,\n", " 'pressure': 1013,\n", " 'sea_level': 1013,\n", " 'grnd_level': 1012,\n", " 'humidity': 95,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 500,\n", " 'main': 'Rain',\n", " 'description': 'light rain',\n", " 'icon': '10n'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 5.57, 'deg': 203, 'gust': 19.33},\n", " 'visibility': 10000,\n", " 'pop': 1,\n", " 'rain': {'3h': 2.58},\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-01 03:00:00'},\n", " {'dt': 1680328800,\n", " 'main': {'temp': 44.22,\n", " 'feels_like': 42.78,\n", " 'temp_min': 44.22,\n", " 'temp_max': 44.22,\n", " 'pressure': 1010,\n", " 'sea_level': 1010,\n", " 'grnd_level': 1010,\n", " 'humidity': 97,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 500,\n", " 'main': 'Rain',\n", " 'description': 'light rain',\n", " 'icon': '10n'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 3.36, 'deg': 275, 'gust': 10.54},\n", " 'visibility': 10000,\n", " 'pop': 1,\n", " 'rain': {'3h': 0.11},\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-01 06:00:00'},\n", " {'dt': 1680339600,\n", " 'main': {'temp': 43.02,\n", " 'feels_like': 43.02,\n", " 'temp_min': 43.02,\n", " 'temp_max': 43.02,\n", " 'pressure': 1008,\n", " 'sea_level': 1008,\n", " 'grnd_level': 1007,\n", " 'humidity': 98,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04n'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 1.01, 'deg': 284, 'gust': 2.06},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-01 09:00:00'},\n", " {'dt': 1680350400,\n", " 'main': {'temp': 45.32,\n", " 'feels_like': 42.17,\n", " 'temp_min': 45.32,\n", " 'temp_max': 45.32,\n", " 'pressure': 1004,\n", " 'sea_level': 1004,\n", " 'grnd_level': 1003,\n", " 'humidity': 99,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 500,\n", " 'main': 'Rain',\n", " 'description': 'light rain',\n", " 'icon': '10d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 5.88, 'deg': 156, 'gust': 20.92},\n", " 'visibility': 683,\n", " 'pop': 0.31,\n", " 'rain': {'3h': 0.47},\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-01 12:00:00'},\n", " {'dt': 1680361200,\n", " 'main': {'temp': 51.85,\n", " 'feels_like': 51.26,\n", " 'temp_min': 51.85,\n", " 'temp_max': 51.85,\n", " 'pressure': 999,\n", " 'sea_level': 999,\n", " 'grnd_level': 998,\n", " 'humidity': 96,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 501,\n", " 'main': 'Rain',\n", " 'description': 'moderate rain',\n", " 'icon': '10d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 12.82, 'deg': 206, 'gust': 39.1},\n", " 'visibility': 10000,\n", " 'pop': 1,\n", " 'rain': {'3h': 5.56},\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-01 15:00:00'},\n", " {'dt': 1680372000,\n", " 'main': {'temp': 56.88,\n", " 'feels_like': 56.53,\n", " 'temp_min': 56.88,\n", " 'temp_max': 56.88,\n", " 'pressure': 995,\n", " 'sea_level': 995,\n", " 'grnd_level': 994,\n", " 'humidity': 91,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 500,\n", " 'main': 'Rain',\n", " 'description': 'light rain',\n", " 'icon': '10d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 15.64, 'deg': 217, 'gust': 38.79},\n", " 'visibility': 10000,\n", " 'pop': 1,\n", " 'rain': {'3h': 1.92},\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-01 18:00:00'},\n", " {'dt': 1680382800,\n", " 'main': {'temp': 57.31,\n", " 'feels_like': 56.97,\n", " 'temp_min': 57.31,\n", " 'temp_max': 57.31,\n", " 'pressure': 993,\n", " 'sea_level': 993,\n", " 'grnd_level': 992,\n", " 'humidity': 90,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 500,\n", " 'main': 'Rain',\n", " 'description': 'light rain',\n", " 'icon': '10d'}],\n", " 'clouds': {'all': 95},\n", " 'wind': {'speed': 13.76, 'deg': 215, 'gust': 30.51},\n", " 'visibility': 10000,\n", " 'pop': 0.47,\n", " 'rain': {'3h': 0.65},\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-01 21:00:00'},\n", " {'dt': 1680393600,\n", " 'main': {'temp': 53.85,\n", " 'feels_like': 53.22,\n", " 'temp_min': 53.85,\n", " 'temp_max': 53.85,\n", " 'pressure': 990,\n", " 'sea_level': 990,\n", " 'grnd_level': 989,\n", " 'humidity': 91,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 803,\n", " 'main': 'Clouds',\n", " 'description': 'broken clouds',\n", " 'icon': '04n'}],\n", " 'clouds': {'all': 82},\n", " 'wind': {'speed': 13.6, 'deg': 190, 'gust': 40.85},\n", " 'visibility': 10000,\n", " 'pop': 0.38,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-02 00:00:00'},\n", " {'dt': 1680404400,\n", " 'main': {'temp': 50.97,\n", " 'feels_like': 49.68,\n", " 'temp_min': 50.97,\n", " 'temp_max': 50.97,\n", " 'pressure': 989,\n", " 'sea_level': 989,\n", " 'grnd_level': 989,\n", " 'humidity': 83,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 500,\n", " 'main': 'Rain',\n", " 'description': 'light rain',\n", " 'icon': '10n'}],\n", " 'clouds': {'all': 76},\n", " 'wind': {'speed': 9.28, 'deg': 269, 'gust': 23.6},\n", " 'visibility': 10000,\n", " 'pop': 0.96,\n", " 'rain': {'3h': 1.68},\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-02 03:00:00'},\n", " {'dt': 1680415200,\n", " 'main': {'temp': 46.87,\n", " 'feels_like': 40.05,\n", " 'temp_min': 46.87,\n", " 'temp_max': 46.87,\n", " 'pressure': 994,\n", " 'sea_level': 994,\n", " 'grnd_level': 993,\n", " 'humidity': 78,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04n'}],\n", " 'clouds': {'all': 87},\n", " 'wind': {'speed': 17.43, 'deg': 274, 'gust': 34.29},\n", " 'visibility': 10000,\n", " 'pop': 0.81,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-02 06:00:00'},\n", " {'dt': 1680426000,\n", " 'main': {'temp': 40.89,\n", " 'feels_like': 32.5,\n", " 'temp_min': 40.89,\n", " 'temp_max': 40.89,\n", " 'pressure': 1000,\n", " 'sea_level': 1000,\n", " 'grnd_level': 999,\n", " 'humidity': 65,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 803,\n", " 'main': 'Clouds',\n", " 'description': 'broken clouds',\n", " 'icon': '04n'}],\n", " 'clouds': {'all': 83},\n", " 'wind': {'speed': 16.67, 'deg': 308, 'gust': 34.05},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-02 09:00:00'},\n", " {'dt': 1680436800,\n", " 'main': {'temp': 33.8,\n", " 'feels_like': 23.29,\n", " 'temp_min': 33.8,\n", " 'temp_max': 33.8,\n", " 'pressure': 1006,\n", " 'sea_level': 1006,\n", " 'grnd_level': 1006,\n", " 'humidity': 52,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 802,\n", " 'main': 'Clouds',\n", " 'description': 'scattered clouds',\n", " 'icon': '03d'}],\n", " 'clouds': {'all': 44},\n", " 'wind': {'speed': 16.84, 'deg': 316, 'gust': 36.42},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-02 12:00:00'},\n", " {'dt': 1680447600,\n", " 'main': {'temp': 36.88,\n", " 'feels_like': 26.98,\n", " 'temp_min': 36.88,\n", " 'temp_max': 36.88,\n", " 'pressure': 1011,\n", " 'sea_level': 1011,\n", " 'grnd_level': 1010,\n", " 'humidity': 29,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 800,\n", " 'main': 'Clear',\n", " 'description': 'clear sky',\n", " 'icon': '01d'}],\n", " 'clouds': {'all': 0},\n", " 'wind': {'speed': 17.81, 'deg': 326, 'gust': 27.78},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-02 15:00:00'},\n", " {'dt': 1680458400,\n", " 'main': {'temp': 41.9,\n", " 'feels_like': 34.39,\n", " 'temp_min': 41.9,\n", " 'temp_max': 41.9,\n", " 'pressure': 1013,\n", " 'sea_level': 1013,\n", " 'grnd_level': 1013,\n", " 'humidity': 25,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 800,\n", " 'main': 'Clear',\n", " 'description': 'clear sky',\n", " 'icon': '01d'}],\n", " 'clouds': {'all': 0},\n", " 'wind': {'speed': 14.56, 'deg': 327, 'gust': 21.83},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-02 18:00:00'},\n", " {'dt': 1680469200,\n", " 'main': {'temp': 42.98,\n", " 'feels_like': 36.48,\n", " 'temp_min': 42.98,\n", " 'temp_max': 42.98,\n", " 'pressure': 1015,\n", " 'sea_level': 1015,\n", " 'grnd_level': 1014,\n", " 'humidity': 26,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 800,\n", " 'main': 'Clear',\n", " 'description': 'clear sky',\n", " 'icon': '01d'}],\n", " 'clouds': {'all': 0},\n", " 'wind': {'speed': 12.35, 'deg': 323, 'gust': 17.69},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-02 21:00:00'},\n", " {'dt': 1680480000,\n", " 'main': {'temp': 38.08,\n", " 'feels_like': 31.71,\n", " 'temp_min': 38.08,\n", " 'temp_max': 38.08,\n", " 'pressure': 1018,\n", " 'sea_level': 1018,\n", " 'grnd_level': 1017,\n", " 'humidity': 33,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 800,\n", " 'main': 'Clear',\n", " 'description': 'clear sky',\n", " 'icon': '01n'}],\n", " 'clouds': {'all': 7},\n", " 'wind': {'speed': 9.06, 'deg': 331, 'gust': 17.9},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-03 00:00:00'},\n", " {'dt': 1680490800,\n", " 'main': {'temp': 34.29,\n", " 'feels_like': 28.71,\n", " 'temp_min': 34.29,\n", " 'temp_max': 34.29,\n", " 'pressure': 1020,\n", " 'sea_level': 1020,\n", " 'grnd_level': 1019,\n", " 'humidity': 38,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 800,\n", " 'main': 'Clear',\n", " 'description': 'clear sky',\n", " 'icon': '01n'}],\n", " 'clouds': {'all': 9},\n", " 'wind': {'speed': 6.33, 'deg': 329, 'gust': 13.4},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-03 03:00:00'},\n", " {'dt': 1680501600,\n", " 'main': {'temp': 33.15,\n", " 'feels_like': 33.15,\n", " 'temp_min': 33.15,\n", " 'temp_max': 33.15,\n", " 'pressure': 1020,\n", " 'sea_level': 1020,\n", " 'grnd_level': 1020,\n", " 'humidity': 38,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 801,\n", " 'main': 'Clouds',\n", " 'description': 'few clouds',\n", " 'icon': '02n'}],\n", " 'clouds': {'all': 23},\n", " 'wind': {'speed': 2.46, 'deg': 285, 'gust': 4.25},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-03 06:00:00'},\n", " {'dt': 1680512400,\n", " 'main': {'temp': 32.61,\n", " 'feels_like': 28.92,\n", " 'temp_min': 32.61,\n", " 'temp_max': 32.61,\n", " 'pressure': 1021,\n", " 'sea_level': 1021,\n", " 'grnd_level': 1020,\n", " 'humidity': 45,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 802,\n", " 'main': 'Clouds',\n", " 'description': 'scattered clouds',\n", " 'icon': '03n'}],\n", " 'clouds': {'all': 28},\n", " 'wind': {'speed': 3.87, 'deg': 212, 'gust': 7.43},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-03 09:00:00'},\n", " {'dt': 1680523200,\n", " 'main': {'temp': 36.1,\n", " 'feels_like': 31.01,\n", " 'temp_min': 36.1,\n", " 'temp_max': 36.1,\n", " 'pressure': 1021,\n", " 'sea_level': 1021,\n", " 'grnd_level': 1021,\n", " 'humidity': 42,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 802,\n", " 'main': 'Clouds',\n", " 'description': 'scattered clouds',\n", " 'icon': '03d'}],\n", " 'clouds': {'all': 32},\n", " 'wind': {'speed': 6.15, 'deg': 207, 'gust': 12.19},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-03 12:00:00'},\n", " {'dt': 1680534000,\n", " 'main': {'temp': 46.47,\n", " 'feels_like': 41.2,\n", " 'temp_min': 46.47,\n", " 'temp_max': 46.47,\n", " 'pressure': 1019,\n", " 'sea_level': 1019,\n", " 'grnd_level': 1019,\n", " 'humidity': 31,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 11.32, 'deg': 210, 'gust': 19.01},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-03 15:00:00'},\n", " {'dt': 1680544800,\n", " 'main': {'temp': 55.96,\n", " 'feels_like': 52.75,\n", " 'temp_min': 55.96,\n", " 'temp_max': 55.96,\n", " 'pressure': 1016,\n", " 'sea_level': 1016,\n", " 'grnd_level': 1015,\n", " 'humidity': 32,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 98},\n", " 'wind': {'speed': 14.67, 'deg': 213, 'gust': 24.99},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-03 18:00:00'},\n", " {'dt': 1680555600,\n", " 'main': {'temp': 55.2,\n", " 'feels_like': 52.36,\n", " 'temp_min': 55.2,\n", " 'temp_max': 55.2,\n", " 'pressure': 1012,\n", " 'sea_level': 1012,\n", " 'grnd_level': 1012,\n", " 'humidity': 41,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 803,\n", " 'main': 'Clouds',\n", " 'description': 'broken clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 72},\n", " 'wind': {'speed': 16.69, 'deg': 206, 'gust': 33.13},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-03 21:00:00'},\n", " {'dt': 1680566400,\n", " 'main': {'temp': 49.42,\n", " 'feels_like': 43.74,\n", " 'temp_min': 49.42,\n", " 'temp_max': 49.42,\n", " 'pressure': 1012,\n", " 'sea_level': 1012,\n", " 'grnd_level': 1012,\n", " 'humidity': 60,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 803,\n", " 'main': 'Clouds',\n", " 'description': 'broken clouds',\n", " 'icon': '04n'}],\n", " 'clouds': {'all': 67},\n", " 'wind': {'speed': 15.75, 'deg': 211, 'gust': 41.29},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-04 00:00:00'},\n", " {'dt': 1680577200,\n", " 'main': {'temp': 49.73,\n", " 'feels_like': 45.34,\n", " 'temp_min': 49.73,\n", " 'temp_max': 49.73,\n", " 'pressure': 1013,\n", " 'sea_level': 1013,\n", " 'grnd_level': 1013,\n", " 'humidity': 69,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04n'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 11.14, 'deg': 239, 'gust': 32.88},\n", " 'visibility': 10000,\n", " 'pop': 0.08,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-04 03:00:00'},\n", " {'dt': 1680588000,\n", " 'main': {'temp': 47.26,\n", " 'feels_like': 45.37,\n", " 'temp_min': 47.26,\n", " 'temp_max': 47.26,\n", " 'pressure': 1015,\n", " 'sea_level': 1015,\n", " 'grnd_level': 1014,\n", " 'humidity': 87,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 500,\n", " 'main': 'Rain',\n", " 'description': 'light rain',\n", " 'icon': '10n'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 4.45, 'deg': 297, 'gust': 17},\n", " 'visibility': 10000,\n", " 'pop': 0.62,\n", " 'rain': {'3h': 1.05},\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-04 06:00:00'},\n", " {'dt': 1680598800,\n", " 'main': {'temp': 46.58,\n", " 'feels_like': 44.96,\n", " 'temp_min': 46.58,\n", " 'temp_max': 46.58,\n", " 'pressure': 1015,\n", " 'sea_level': 1015,\n", " 'grnd_level': 1014,\n", " 'humidity': 87,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 500,\n", " 'main': 'Rain',\n", " 'description': 'light rain',\n", " 'icon': '10n'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 3.96, 'deg': 191, 'gust': 6.64},\n", " 'visibility': 10000,\n", " 'pop': 0.29,\n", " 'rain': {'3h': 0.37},\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-04 09:00:00'},\n", " {'dt': 1680609600,\n", " 'main': {'temp': 47.77,\n", " 'feels_like': 46.71,\n", " 'temp_min': 47.77,\n", " 'temp_max': 47.77,\n", " 'pressure': 1016,\n", " 'sea_level': 1016,\n", " 'grnd_level': 1015,\n", " 'humidity': 83,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 3.49, 'deg': 233, 'gust': 6.98},\n", " 'visibility': 10000,\n", " 'pop': 0.23,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-04 12:00:00'},\n", " {'dt': 1680620400,\n", " 'main': {'temp': 54.27,\n", " 'feels_like': 52.39,\n", " 'temp_min': 54.27,\n", " 'temp_max': 54.27,\n", " 'pressure': 1016,\n", " 'sea_level': 1016,\n", " 'grnd_level': 1016,\n", " 'humidity': 64,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 4.07, 'deg': 225, 'gust': 6.46},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-04 15:00:00'},\n", " {'dt': 1680631200,\n", " 'main': {'temp': 60.22,\n", " 'feels_like': 58.3,\n", " 'temp_min': 60.22,\n", " 'temp_max': 60.22,\n", " 'pressure': 1017,\n", " 'sea_level': 1017,\n", " 'grnd_level': 1016,\n", " 'humidity': 50,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 3.94, 'deg': 291, 'gust': 8.81},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-04 18:00:00'},\n", " {'dt': 1680642000,\n", " 'main': {'temp': 62.11,\n", " 'feels_like': 60.19,\n", " 'temp_min': 62.11,\n", " 'temp_max': 62.11,\n", " 'pressure': 1017,\n", " 'sea_level': 1017,\n", " 'grnd_level': 1017,\n", " 'humidity': 46,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 4.12, 'deg': 303, 'gust': 8.66},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-04-04 21:00:00'},\n", " {'dt': 1680652800,\n", " 'main': {'temp': 53.73,\n", " 'feels_like': 51.8,\n", " 'temp_min': 53.73,\n", " 'temp_max': 53.73,\n", " 'pressure': 1021,\n", " 'sea_level': 1021,\n", " 'grnd_level': 1020,\n", " 'humidity': 64,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04n'}],\n", " 'clouds': {'all': 97},\n", " 'wind': {'speed': 3.98, 'deg': 59, 'gust': 7.49},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-05 00:00:00'},\n", " {'dt': 1680663600,\n", " 'main': {'temp': 50.13,\n", " 'feels_like': 48.22,\n", " 'temp_min': 50.13,\n", " 'temp_max': 50.13,\n", " 'pressure': 1022,\n", " 'sea_level': 1022,\n", " 'grnd_level': 1021,\n", " 'humidity': 72,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 801,\n", " 'main': 'Clouds',\n", " 'description': 'few clouds',\n", " 'icon': '02n'}],\n", " 'clouds': {'all': 22},\n", " 'wind': {'speed': 2.77, 'deg': 56, 'gust': 3.58},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-05 03:00:00'},\n", " {'dt': 1680674400,\n", " 'main': {'temp': 46.22,\n", " 'feels_like': 42.85,\n", " 'temp_min': 46.22,\n", " 'temp_max': 46.22,\n", " 'pressure': 1023,\n", " 'sea_level': 1023,\n", " 'grnd_level': 1022,\n", " 'humidity': 78,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 802,\n", " 'main': 'Clouds',\n", " 'description': 'scattered clouds',\n", " 'icon': '03n'}],\n", " 'clouds': {'all': 40},\n", " 'wind': {'speed': 6.55, 'deg': 27, 'gust': 13.62},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-05 06:00:00'},\n", " {'dt': 1680685200,\n", " 'main': {'temp': 43.72,\n", " 'feels_like': 38.93,\n", " 'temp_min': 43.72,\n", " 'temp_max': 43.72,\n", " 'pressure': 1024,\n", " 'sea_level': 1024,\n", " 'grnd_level': 1023,\n", " 'humidity': 84,\n", " 'temp_kf': 0},\n", " 'weather': [{'id': 801,\n", " 'main': 'Clouds',\n", " 'description': 'few clouds',\n", " 'icon': '02n'}],\n", " 'clouds': {'all': 20},\n", " 'wind': {'speed': 8.39, 'deg': 52, 'gust': 17.34},\n", " 'visibility': 10000,\n", " 'pop': 0,\n", " 'sys': {'pod': 'n'},\n", " 'dt_txt': '2023-04-05 09:00:00'}]" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "weather_dict['list']" ] }, { "cell_type": "markdown", "id": "f3c16f79", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Cleaning up data from one instant" ] }, { "cell_type": "code", "execution_count": 50, "id": "36269c9a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'dt': 1680296400,\n", " 'main': {'temp': 47.37,\n", " 'feels_like': 42.04,\n", " 'temp_min': 46.42,\n", " 'temp_max': 47.37,\n", " 'pressure': 1020,\n", " 'sea_level': 1020,\n", " 'grnd_level': 1020,\n", " 'humidity': 45,\n", " 'temp_kf': 0.53},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 12.24, 'deg': 190, 'gust': 19.26},\n", " 'visibility': 10000,\n", " 'pop': 0.02,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-03-31 21:00:00',\n", " 'datetime': datetime.datetime(2023, 3, 31, 17, 0)}" ] }, "execution_count": 50, "metadata": {}, "output_type": "execute_result" } ], "source": [ "d = weather_dict['list'][0]\n", "d" ] }, { "cell_type": "code", "execution_count": 51, "id": "82ec7713", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "{'dt': 1680296400,\n", " 'main': {'temp': 47.37,\n", " 'feels_like': 42.04,\n", " 'temp_min': 46.42,\n", " 'temp_max': 47.37,\n", " 'pressure': 1020,\n", " 'sea_level': 1020,\n", " 'grnd_level': 1020,\n", " 'humidity': 45,\n", " 'temp_kf': 0.53},\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 12.24, 'deg': 190, 'gust': 19.26},\n", " 'visibility': 10000,\n", " 'pop': 0.02,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-03-31 21:00:00',\n", " 'datetime': datetime.datetime(2023, 3, 31, 17, 0)}" ] }, "execution_count": 51, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# lets convert from unix time to a datetime (easier to use)\n", "d['datetime'] = datetime.fromtimestamp(d['dt'])\n", "\n", "d" ] }, { "cell_type": "code", "execution_count": null, "id": "34fa165a", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "dc225769", "metadata": {}, "outputs": [], "source": [ "# lets \"flatten\" the main dictionary\n", "d.update(d['main'])\n", "\n", "# for key, val in d['main'].items():\n", "# d[key] = val" ] }, { "cell_type": "code", "execution_count": 52, "id": "59086e4f", "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "{'dt': 1680296400,\n", " 'weather': [{'id': 804,\n", " 'main': 'Clouds',\n", " 'description': 'overcast clouds',\n", " 'icon': '04d'}],\n", " 'clouds': {'all': 100},\n", " 'wind': {'speed': 12.24, 'deg': 190, 'gust': 19.26},\n", " 'visibility': 10000,\n", " 'pop': 0.02,\n", " 'sys': {'pod': 'd'},\n", " 'dt_txt': '2023-03-31 21:00:00',\n", " 'datetime': datetime.datetime(2023, 3, 31, 17, 0),\n", " 'temp': 47.37,\n", " 'feels_like': 42.04,\n", " 'temp_min': 46.42,\n", " 'temp_max': 47.37,\n", " 'pressure': 1020,\n", " 'sea_level': 1020,\n", " 'grnd_level': 1020,\n", " 'humidity': 45,\n", " 'temp_kf': 0.53}" ] }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# removing key \"main\" and its associated value from d\n", "del d['main']\n", "\n", "d" ] }, { "cell_type": "markdown", "id": "d252d486", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Why doesn't our datetime match the \"dt_txt\"?\n", "\n", "[lets examine the API's documentation](https://openweathermap.org/forecast5)\n", "\n", "(spoiler: the forecasted day is in UTC 00:00, our function converts it to our computer's timezone ... see how sneaky measuring time can be?)" ] }, { "cell_type": "markdown", "id": "346d2cf0", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Storing an API key in another file\n", "\n", "- security of your account\n", "- easily swappable with another user" ] }, { "cell_type": "code", "execution_count": 25, "id": "e5b86ee5", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'eea5fcef9a7ea19505dc1c165bacac4a'" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from weather_api import api_key\n", "\n", "# nice to keep it a bit more hidden in your code\n", "# (though you'd do better not to parrot it on a jupyter output cell,\n", "# I just want to show you all how this works)\n", "api_key" ] }, { "cell_type": "markdown", "id": "dbad9bd6", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## In Class Activity 2\n", " \n", "1. Make a function `get_forecast` which accepts:\n", " - `lat`\n", " - `lon`\n", " - `api_key`\n", " - `units` (default = 'imperial')\n", " \n", " and returns a dataframe of the forecasted weather\n", " \n", "```python\n", "# clean it up\n", "row_list = list()\n", "for d in weather_dict['list']:\n", " # process dictionary into a row\n", "\n", " # store\n", " row_list.append(d)\n", "\n", "# convert list of dictionaries to dataframe\n", "df = pd.DataFrame(row_list)\n", "```\n", "\n", "2. \"flatten\" the parts of the dictionary which make sense (see \"main\" example a few cells above).\n", "\n", "\n", "## Test Case\n", "\n", "Osaka, Japan is located at:\n", "\n", " 34.6937° N, 135.5023° E\n", " \n", "The first few rows of my call \n", "\n", "```python\n", "df_osaka = get_forecast(lat=34.6937, lon=135.5023, api_key=api_key)\n", "```\n", "\n", "yielded the following dataframe:\n", "\n", "| | dt | visibility | pop | dt_txt | all | speed | deg | gust | pod | temp | feels_like | temp_min | temp_max | pressure | sea_level | grnd_level | humidity | temp_kf | id | main | description | icon |\n", "|---|------------|------------|-----|---------------------|-----|-------|-----|------|-----|-------|------------|----------|----------|----------|-----------|------------|----------|---------|-----|--------|-------------|------|\n", "| 0 | 1680264000 | 10000 | 0 | 2023-03-31 12:00:00 | 0 | 4.79 | 222 | 7.87 | n | 60.35 | 58.24 | 60.04 | 60.35 | 1016 | 1016 | 1016 | 46 | 0.17 | 800 | Clear | clear sky | 01n |\n", "| 1 | 1680274800 | 10000 | 0 | 2023-03-31 15:00:00 | 11 | 3.18 | 211 | 6.51 | n | 59.38 | 57.56 | 57.43 | 59.38 | 1017 | 1017 | 1016 | 54 | 1.08 | 801 | Clouds | few clouds | 02n |\n", "| 2 | 1680285600 | 10000 | 0 | 2023-03-31 18:00:00 | 21 | 1.72 | 78 | 2.37 | n | 57.18 | 55.42 | 55.6 | 57.18 | 1017 | 1017 | 1015 | 60 | 0.88 | 801 | Clouds | few clouds | 02n |\n", "| 3 | 1680296400 | 10000 | 0 | 2023-03-31 21:00:00 | 4 | 3 | 58 | 4.52 | d | 53.69 | 51.82 | 53.69 | 53.69 | 1017 | 1017 | 1015 | 65 | 0 | 800 | Clear | clear sky | 01d |\n", "| 4 | 1680307200 | 10000 | 0 | 2023-04-01 00:00:00 | 2 | 3.69 | 50 | 4.34 | d | 61.18 | 59.25 | 61.18 | 61.18 | 1018 | 1018 | 1016 | 48 | 0 | 800 | Clear | clear sky | 01d |" ] }, { "cell_type": "code", "execution_count": 53, "id": "a65a3b4b", "metadata": {}, "outputs": [], "source": [ "\n", "from weather_api import api_key\n", "\n", "\n", "def get_forecast(lat, lon, api_key, units='imperial'):\n", " \"\"\" returns forecast\n", " \n", " https://openweathermap.org/forecast5\n", " \n", " Args:\n", " lat (float): lattitude (positive is north)\n", " lon (float): longitude (positive is east)\n", " api_key (str): api key for openweather\n", " units (str): standard, metric or imperial. see link for\n", " details\n", " \n", " Returns:\n", " df (pd.DataFrame): forecasted weather, one row per \n", " instant and one column per feature\n", " \"\"\"\n", " \n", " # get data from api\n", " url = f'https://api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&units={units}&appid={api_key}'\n", " url_text = requests.get(url).text \n", " weather_dict = json.loads(url_text)\n", " \n", " # clean it up\n", " row_list = list()\n", " for d in weather_dict['list']:\n", " # process dictionary into a row\n", " \n", " # lets \"flatten\" the main dictionary\n", " for feat in ['clouds', 'wind', 'sys', 'main']:\n", " d.update(d[feat])\n", " del d[feat]\n", " \n", " # flattening \"weather\" is funny, its a list (of length 1) of dicts\n", " d.update(d['weather'][0])\n", " del d['weather']\n", "\n", " row_list.append(d)\n", " \n", " return pd.DataFrame(row_list)" ] }, { "cell_type": "code", "execution_count": 55, "id": "7aa224ee", "metadata": {}, "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", " \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", " \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", " \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", " \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", " \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", " \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", "
dtvisibilitypopdt_txtallspeeddeggustpodtemp...pressuresea_levelgrnd_levelhumiditytemp_kfidmaindescriptioniconrain
01680296400100000.002023-03-31 21:00:009311.3213515.82n57.56...102210221014680.00804Cloudsovercast clouds04nNaN
11680307200100000.002023-04-01 00:00:008813.0413113.94d58.66...10221022101563-1.23804Cloudsovercast clouds04dNaN
21680318000100000.002023-04-01 03:00:007011.8813811.92d61.86...10221022101454-1.20803Cloudsbroken clouds04dNaN
31680328800100000.002023-04-01 06:00:004314.9913814.32d63.30...102110211013480.00802Cloudsscattered clouds03dNaN
41680339600100000.002023-04-01 09:00:001010.1112814.56n58.93...102210221014540.00800Clearclear sky01nNaN
51680350400100000.002023-04-01 12:00:0067.4912813.24n56.77...102310231014620.00800Clearclear sky01nNaN
61680361200100000.002023-04-01 15:00:0089.7311717.74n55.72...102110211013680.00800Clearclear sky01nNaN
71680372000100000.002023-04-01 18:00:0066.9611211.97n54.39...102010201012720.00800Clearclear sky01nNaN
81680382800100000.002023-04-01 21:00:00519.429713.47n58.78...102010201012610.00803Cloudsbroken clouds04nNaN
91680393600100000.002023-04-02 00:00:00769.109211.90d61.36...102010201012590.00803Cloudsbroken clouds04dNaN
101680404400100000.002023-04-02 03:00:00968.34919.93d64.92...101910191011530.00804Cloudsovercast clouds04dNaN
111680415200100000.002023-04-02 06:00:007611.7911911.03d67.28...101610161008490.00803Cloudsbroken clouds04dNaN
121680426000100000.002023-04-02 09:00:00211.2711716.33n60.60...101710171009600.00800Clearclear sky01nNaN
131680436800100000.002023-04-02 12:00:0038.3010917.05n57.58...101810181010720.00800Clearclear sky01nNaN
141680447600100000.002023-04-02 15:00:0027.389615.99n56.64...101710171009740.00800Clearclear sky01nNaN
151680458400100000.002023-04-02 18:00:0075.88918.41n55.98...101610161008800.00800Clearclear sky01nNaN
161680469200100000.002023-04-02 21:00:00103.67764.07n55.81...101610161008810.00800Clearclear sky01nNaN
171680480000100000.002023-04-03 00:00:00142.82455.03d66.18...101710171009520.00801Cloudsfew clouds02dNaN
181680490800100000.002023-04-03 03:00:0077.142397.65d69.96...101610161008460.00800Clearclear sky01dNaN
191680501600100000.002023-04-03 06:00:0075.612156.69d69.67...101410141006450.00800Clearclear sky01dNaN
201680512400100000.002023-04-03 09:00:0097.201459.33n64.62...101510151007610.00800Clearclear sky01nNaN
211680523200100000.002023-04-03 12:00:0086.297813.02n62.26...101510151007660.00800Clearclear sky01nNaN
221680534000100000.002023-04-03 15:00:00106.497113.38n62.60...101410141006590.00800Clearclear sky01nNaN
231680544800100000.002023-04-03 18:00:00277.276017.76n62.62...101310131005560.00802Cloudsscattered clouds03nNaN
241680555600100000.002023-04-03 21:00:0076.983516.13n62.08...101310131005460.00800Clearclear sky01nNaN
251680566400100000.002023-04-04 00:00:001511.63420.94d74.53...101410141006300.00801Cloudsfew clouds02dNaN
261680577200100000.002023-04-04 03:00:0059.2232912.93d81.43...101210121004290.00800Clearclear sky01dNaN
271680588000100000.002023-04-04 06:00:00406.421117.83d81.66...101010101002290.00802Cloudsscattered clouds03dNaN
281680598800100000.002023-04-04 09:00:0010012.883926.69n76.41...101010101003330.00804Cloudsovercast clouds04nNaN
291680609600100000.002023-04-04 12:00:001006.1134312.55n72.61...101110111003440.00804Cloudsovercast clouds04nNaN
301680620400100000.052023-04-04 15:00:0010013.471628.70n73.63...100910091001340.00804Cloudsovercast clouds04nNaN
311680631200100000.302023-04-04 18:00:001007.3134113.40n64.65...100910091001780.00500Rainlight rain10n{'3h': 0.19}
321680642000100000.002023-04-04 21:00:001007.765320.27n66.06...100810081000680.00804Cloudsovercast clouds04nNaN
331680652800100000.322023-04-05 00:00:0010016.201726.06d66.88...10071007999630.00500Rainlight rain10d{'3h': 0.17}
341680663600100000.582023-04-05 03:00:008716.7835123.26d72.36...10051005997640.00500Rainlight rain10d{'3h': 0.35}
35168067440098541.002023-04-05 06:00:008916.2231022.48d67.60...10041004996750.00500Rainlight rain10d{'3h': 2.25}
361680685200100000.402023-04-05 09:00:003212.8432224.34n63.99...10041004996840.00500Rainlight rain10n{'3h': 0.11}
371680696000100000.232023-04-05 12:00:001717.9033531.34n63.39...10031003995730.00801Cloudsfew clouds02nNaN
381680706800100000.222023-04-05 15:00:003124.5633338.39n64.83...10011001993730.00802Cloudsscattered clouds03nNaN
391680717600100000.772023-04-05 18:00:006226.7332239.64n62.49...999999991880.00500Rainlight rain10n{'3h': 2.56}
\n", "

40 rows × 23 columns

\n", "
" ], "text/plain": [ " dt visibility pop dt_txt all speed deg gust \\\n", "0 1680296400 10000 0.00 2023-03-31 21:00:00 93 11.32 135 15.82 \n", "1 1680307200 10000 0.00 2023-04-01 00:00:00 88 13.04 131 13.94 \n", "2 1680318000 10000 0.00 2023-04-01 03:00:00 70 11.88 138 11.92 \n", "3 1680328800 10000 0.00 2023-04-01 06:00:00 43 14.99 138 14.32 \n", "4 1680339600 10000 0.00 2023-04-01 09:00:00 10 10.11 128 14.56 \n", "5 1680350400 10000 0.00 2023-04-01 12:00:00 6 7.49 128 13.24 \n", "6 1680361200 10000 0.00 2023-04-01 15:00:00 8 9.73 117 17.74 \n", "7 1680372000 10000 0.00 2023-04-01 18:00:00 6 6.96 112 11.97 \n", "8 1680382800 10000 0.00 2023-04-01 21:00:00 51 9.42 97 13.47 \n", "9 1680393600 10000 0.00 2023-04-02 00:00:00 76 9.10 92 11.90 \n", "10 1680404400 10000 0.00 2023-04-02 03:00:00 96 8.34 91 9.93 \n", "11 1680415200 10000 0.00 2023-04-02 06:00:00 76 11.79 119 11.03 \n", "12 1680426000 10000 0.00 2023-04-02 09:00:00 2 11.27 117 16.33 \n", "13 1680436800 10000 0.00 2023-04-02 12:00:00 3 8.30 109 17.05 \n", "14 1680447600 10000 0.00 2023-04-02 15:00:00 2 7.38 96 15.99 \n", "15 1680458400 10000 0.00 2023-04-02 18:00:00 7 5.88 91 8.41 \n", "16 1680469200 10000 0.00 2023-04-02 21:00:00 10 3.67 76 4.07 \n", "17 1680480000 10000 0.00 2023-04-03 00:00:00 14 2.82 45 5.03 \n", "18 1680490800 10000 0.00 2023-04-03 03:00:00 7 7.14 239 7.65 \n", "19 1680501600 10000 0.00 2023-04-03 06:00:00 7 5.61 215 6.69 \n", "20 1680512400 10000 0.00 2023-04-03 09:00:00 9 7.20 145 9.33 \n", "21 1680523200 10000 0.00 2023-04-03 12:00:00 8 6.29 78 13.02 \n", "22 1680534000 10000 0.00 2023-04-03 15:00:00 10 6.49 71 13.38 \n", "23 1680544800 10000 0.00 2023-04-03 18:00:00 27 7.27 60 17.76 \n", "24 1680555600 10000 0.00 2023-04-03 21:00:00 7 6.98 35 16.13 \n", "25 1680566400 10000 0.00 2023-04-04 00:00:00 15 11.63 4 20.94 \n", "26 1680577200 10000 0.00 2023-04-04 03:00:00 5 9.22 329 12.93 \n", "27 1680588000 10000 0.00 2023-04-04 06:00:00 40 6.42 111 7.83 \n", "28 1680598800 10000 0.00 2023-04-04 09:00:00 100 12.88 39 26.69 \n", "29 1680609600 10000 0.00 2023-04-04 12:00:00 100 6.11 343 12.55 \n", "30 1680620400 10000 0.05 2023-04-04 15:00:00 100 13.47 16 28.70 \n", "31 1680631200 10000 0.30 2023-04-04 18:00:00 100 7.31 341 13.40 \n", "32 1680642000 10000 0.00 2023-04-04 21:00:00 100 7.76 53 20.27 \n", "33 1680652800 10000 0.32 2023-04-05 00:00:00 100 16.20 17 26.06 \n", "34 1680663600 10000 0.58 2023-04-05 03:00:00 87 16.78 351 23.26 \n", "35 1680674400 9854 1.00 2023-04-05 06:00:00 89 16.22 310 22.48 \n", "36 1680685200 10000 0.40 2023-04-05 09:00:00 32 12.84 322 24.34 \n", "37 1680696000 10000 0.23 2023-04-05 12:00:00 17 17.90 335 31.34 \n", "38 1680706800 10000 0.22 2023-04-05 15:00:00 31 24.56 333 38.39 \n", "39 1680717600 10000 0.77 2023-04-05 18:00:00 62 26.73 322 39.64 \n", "\n", " pod temp ... pressure sea_level grnd_level humidity temp_kf id \\\n", "0 n 57.56 ... 1022 1022 1014 68 0.00 804 \n", "1 d 58.66 ... 1022 1022 1015 63 -1.23 804 \n", "2 d 61.86 ... 1022 1022 1014 54 -1.20 803 \n", "3 d 63.30 ... 1021 1021 1013 48 0.00 802 \n", "4 n 58.93 ... 1022 1022 1014 54 0.00 800 \n", "5 n 56.77 ... 1023 1023 1014 62 0.00 800 \n", "6 n 55.72 ... 1021 1021 1013 68 0.00 800 \n", "7 n 54.39 ... 1020 1020 1012 72 0.00 800 \n", "8 n 58.78 ... 1020 1020 1012 61 0.00 803 \n", "9 d 61.36 ... 1020 1020 1012 59 0.00 803 \n", "10 d 64.92 ... 1019 1019 1011 53 0.00 804 \n", "11 d 67.28 ... 1016 1016 1008 49 0.00 803 \n", "12 n 60.60 ... 1017 1017 1009 60 0.00 800 \n", "13 n 57.58 ... 1018 1018 1010 72 0.00 800 \n", "14 n 56.64 ... 1017 1017 1009 74 0.00 800 \n", "15 n 55.98 ... 1016 1016 1008 80 0.00 800 \n", "16 n 55.81 ... 1016 1016 1008 81 0.00 800 \n", "17 d 66.18 ... 1017 1017 1009 52 0.00 801 \n", "18 d 69.96 ... 1016 1016 1008 46 0.00 800 \n", "19 d 69.67 ... 1014 1014 1006 45 0.00 800 \n", "20 n 64.62 ... 1015 1015 1007 61 0.00 800 \n", "21 n 62.26 ... 1015 1015 1007 66 0.00 800 \n", "22 n 62.60 ... 1014 1014 1006 59 0.00 800 \n", "23 n 62.62 ... 1013 1013 1005 56 0.00 802 \n", "24 n 62.08 ... 1013 1013 1005 46 0.00 800 \n", "25 d 74.53 ... 1014 1014 1006 30 0.00 801 \n", "26 d 81.43 ... 1012 1012 1004 29 0.00 800 \n", "27 d 81.66 ... 1010 1010 1002 29 0.00 802 \n", "28 n 76.41 ... 1010 1010 1003 33 0.00 804 \n", "29 n 72.61 ... 1011 1011 1003 44 0.00 804 \n", "30 n 73.63 ... 1009 1009 1001 34 0.00 804 \n", "31 n 64.65 ... 1009 1009 1001 78 0.00 500 \n", "32 n 66.06 ... 1008 1008 1000 68 0.00 804 \n", "33 d 66.88 ... 1007 1007 999 63 0.00 500 \n", "34 d 72.36 ... 1005 1005 997 64 0.00 500 \n", "35 d 67.60 ... 1004 1004 996 75 0.00 500 \n", "36 n 63.99 ... 1004 1004 996 84 0.00 500 \n", "37 n 63.39 ... 1003 1003 995 73 0.00 801 \n", "38 n 64.83 ... 1001 1001 993 73 0.00 802 \n", "39 n 62.49 ... 999 999 991 88 0.00 500 \n", "\n", " main description icon rain \n", "0 Clouds overcast clouds 04n NaN \n", "1 Clouds overcast clouds 04d NaN \n", "2 Clouds broken clouds 04d NaN \n", "3 Clouds scattered clouds 03d NaN \n", "4 Clear clear sky 01n NaN \n", "5 Clear clear sky 01n NaN \n", "6 Clear clear sky 01n NaN \n", "7 Clear clear sky 01n NaN \n", "8 Clouds broken clouds 04n NaN \n", "9 Clouds broken clouds 04d NaN \n", "10 Clouds overcast clouds 04d NaN \n", "11 Clouds broken clouds 04d NaN \n", "12 Clear clear sky 01n NaN \n", "13 Clear clear sky 01n NaN \n", "14 Clear clear sky 01n NaN \n", "15 Clear clear sky 01n NaN \n", "16 Clear clear sky 01n NaN \n", "17 Clouds few clouds 02d NaN \n", "18 Clear clear sky 01d NaN \n", "19 Clear clear sky 01d NaN \n", "20 Clear clear sky 01n NaN \n", "21 Clear clear sky 01n NaN \n", "22 Clear clear sky 01n NaN \n", "23 Clouds scattered clouds 03n NaN \n", "24 Clear clear sky 01n NaN \n", "25 Clouds few clouds 02d NaN \n", "26 Clear clear sky 01d NaN \n", "27 Clouds scattered clouds 03d NaN \n", "28 Clouds overcast clouds 04n NaN \n", "29 Clouds overcast clouds 04n NaN \n", "30 Clouds overcast clouds 04n NaN \n", "31 Rain light rain 10n {'3h': 0.19} \n", "32 Clouds overcast clouds 04n NaN \n", "33 Rain light rain 10d {'3h': 0.17} \n", "34 Rain light rain 10d {'3h': 0.35} \n", "35 Rain light rain 10d {'3h': 2.25} \n", "36 Rain light rain 10n {'3h': 0.11} \n", "37 Clouds few clouds 02n NaN \n", "38 Clouds scattered clouds 03n NaN \n", "39 Rain light rain 10n {'3h': 2.56} \n", "\n", "[40 rows x 23 columns]" ] }, "execution_count": 55, "metadata": {}, "output_type": "execute_result" } ], "source": [ "get_forecast(lat=-34.6937, lon=135.5023, api_key=api_key)" ] }, { "cell_type": "code", "execution_count": 54, "id": "1501f143", "metadata": {}, "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", " \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", " \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", " \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", " \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", " \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", " \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", "
dtvisibilitypopdt_txtallspeeddeggustpodtemp...temp_maxpressuresea_levelgrnd_levelhumiditytemp_kfidmaindescriptionicon
01680296400100000.002023-03-31 21:00:0043.22564.00d51.21...53.6910171017101553-1.38800Clearclear sky01d
11680307200100000.002023-04-01 00:00:0034.36375.21d54.70...61.7010171017101549-3.89800Clearclear sky01d
21680318000100000.002023-04-01 03:00:0024.183596.67d64.56...71.2410161016101432-3.71800Clearclear sky01d
31680328800100000.002023-04-01 06:00:0066.423256.67d73.65...73.65101310131011190.00800Clearclear sky01d
41680339600100000.002023-04-01 09:00:009811.3435214.52d67.26...67.26101410141012270.00804Cloudsovercast clouds04d
51680350400100000.002023-04-01 12:00:00878.791213.44n60.53...60.53101610161014410.00804Cloudsovercast clouds04n
61680361200100000.002023-04-01 15:00:001008.031812.17n56.41...56.41101610161014500.00804Cloudsovercast clouds04n
71680372000100000.002023-04-01 18:00:00897.652412.62n53.76...53.76101510151014540.00804Cloudsovercast clouds04n
81680382800100000.002023-04-01 21:00:00977.472313.58d52.20...52.20101610161014560.00804Cloudsovercast clouds04d
91680393600100000.002023-04-02 00:00:00989.912713.76d59.56...59.56101610161015480.00804Cloudsovercast clouds04d
101680404400100000.012023-04-02 03:00:0010011.592313.87d68.27...68.27101510151013410.00804Cloudsovercast clouds04d
111680415200100000.102023-04-02 06:00:0010012.10213.96d69.60...69.60101310131012370.00804Cloudsovercast clouds04d
121680426000100000.152023-04-02 09:00:0010013.9835118.81d59.90...59.90101610161014420.00804Cloudsovercast clouds04d
131680436800100000.112023-04-02 12:00:0010012.08117.65n55.36...55.36101810181016500.00804Cloudsovercast clouds04n
141680447600100000.062023-04-02 15:00:001009.08413.02n53.73...53.73101810181016530.00804Cloudsovercast clouds04n
151680458400100000.142023-04-02 18:00:001007.631310.85n52.18...52.18101910191017610.00804Cloudsovercast clouds04n
161680469200100000.072023-04-02 21:00:001007.90411.59d52.02...52.02102110211019630.00804Cloudsovercast clouds04d
171680480000100000.062023-04-03 00:00:00956.603528.52d55.94...55.94102210221020530.00804Cloudsovercast clouds04d
181680490800100000.032023-04-03 03:00:00174.683515.46d64.38...64.38102110211019360.00801Cloudsfew clouds02d
191680501600100000.032023-04-03 06:00:0083.332785.35d68.11...68.11102010201018310.00800Clearclear sky01d
201680512400100000.002023-04-03 09:00:0026.782797.76d63.88...63.88102210221020390.00800Clearclear sky01d
211680523200100000.002023-04-03 12:00:0013.65258.55n58.35...58.35102510251023550.00800Clearclear sky01n
221680534000100000.002023-04-03 15:00:0013.60235.19n55.42...55.42102610261024640.00800Clearclear sky01n
231680544800100000.002023-04-03 18:00:0013.13644.79n54.05...54.05102510251023700.00800Clearclear sky01n
241680555600100000.002023-04-03 21:00:0002.42563.62d53.02...53.02102610261024740.00800Clearclear sky01d
251680566400100000.002023-04-04 00:00:0011.991863.24d59.70...59.70102710271025570.00800Clearclear sky01d
261680577200100000.002023-04-04 03:00:00997.252427.65d63.14...63.14102610261024500.00804Cloudsovercast clouds04d
271680588000100000.002023-04-04 06:00:00999.082518.34d64.96...64.96102410241022460.00804Cloudsovercast clouds04d
281680598800100000.002023-04-04 09:00:008411.1424213.53d61.70...61.70102410241023590.00803Cloudsbroken clouds04d
291680609600100000.002023-04-04 12:00:00747.7823212.84n59.09...59.09102610261024640.00803Cloudsbroken clouds04n
301680620400100000.002023-04-04 15:00:00454.292377.96n57.22...57.22102610261024670.00802Cloudsscattered clouds03n
311680631200100000.002023-04-04 18:00:00441.861652.84n55.63...55.63102510251023720.00802Cloudsscattered clouds03n
321680642000100000.002023-04-04 21:00:00913.761164.85d53.91...53.91102510251023740.00804Cloudsovercast clouds04d
331680652800100000.002023-04-05 00:00:00954.25863.15d59.68...59.68102410241023530.00804Cloudsovercast clouds04d
341680663600100000.002023-04-05 03:00:001001.862325.66d65.70...65.70102310231021380.00804Cloudsovercast clouds04d
351680674400100000.002023-04-05 06:00:001008.682558.99d66.72...66.72102110211019460.00804Cloudsovercast clouds04d
361680685200100000.002023-04-05 09:00:0010012.1022416.22d64.62...64.62102110211019520.00804Cloudsovercast clouds04d
371680696000100000.002023-04-05 12:00:0010010.0719717.47n62.26...62.26102110211019580.00804Cloudsovercast clouds04n
381680706800100000.002023-04-05 15:00:001003.891286.64n61.54...61.54102010201018580.00804Cloudsovercast clouds04n
391680717600100000.002023-04-05 18:00:001005.261158.72n60.28...60.28101910191017620.00804Cloudsovercast clouds04n
\n", "

40 rows × 22 columns

\n", "
" ], "text/plain": [ " dt visibility pop dt_txt all speed deg gust \\\n", "0 1680296400 10000 0.00 2023-03-31 21:00:00 4 3.22 56 4.00 \n", "1 1680307200 10000 0.00 2023-04-01 00:00:00 3 4.36 37 5.21 \n", "2 1680318000 10000 0.00 2023-04-01 03:00:00 2 4.18 359 6.67 \n", "3 1680328800 10000 0.00 2023-04-01 06:00:00 6 6.42 325 6.67 \n", "4 1680339600 10000 0.00 2023-04-01 09:00:00 98 11.34 352 14.52 \n", "5 1680350400 10000 0.00 2023-04-01 12:00:00 87 8.79 12 13.44 \n", "6 1680361200 10000 0.00 2023-04-01 15:00:00 100 8.03 18 12.17 \n", "7 1680372000 10000 0.00 2023-04-01 18:00:00 89 7.65 24 12.62 \n", "8 1680382800 10000 0.00 2023-04-01 21:00:00 97 7.47 23 13.58 \n", "9 1680393600 10000 0.00 2023-04-02 00:00:00 98 9.91 27 13.76 \n", "10 1680404400 10000 0.01 2023-04-02 03:00:00 100 11.59 23 13.87 \n", "11 1680415200 10000 0.10 2023-04-02 06:00:00 100 12.10 2 13.96 \n", "12 1680426000 10000 0.15 2023-04-02 09:00:00 100 13.98 351 18.81 \n", "13 1680436800 10000 0.11 2023-04-02 12:00:00 100 12.08 1 17.65 \n", "14 1680447600 10000 0.06 2023-04-02 15:00:00 100 9.08 4 13.02 \n", "15 1680458400 10000 0.14 2023-04-02 18:00:00 100 7.63 13 10.85 \n", "16 1680469200 10000 0.07 2023-04-02 21:00:00 100 7.90 4 11.59 \n", "17 1680480000 10000 0.06 2023-04-03 00:00:00 95 6.60 352 8.52 \n", "18 1680490800 10000 0.03 2023-04-03 03:00:00 17 4.68 351 5.46 \n", "19 1680501600 10000 0.03 2023-04-03 06:00:00 8 3.33 278 5.35 \n", "20 1680512400 10000 0.00 2023-04-03 09:00:00 2 6.78 279 7.76 \n", "21 1680523200 10000 0.00 2023-04-03 12:00:00 1 3.65 25 8.55 \n", "22 1680534000 10000 0.00 2023-04-03 15:00:00 1 3.60 23 5.19 \n", "23 1680544800 10000 0.00 2023-04-03 18:00:00 1 3.13 64 4.79 \n", "24 1680555600 10000 0.00 2023-04-03 21:00:00 0 2.42 56 3.62 \n", "25 1680566400 10000 0.00 2023-04-04 00:00:00 1 1.99 186 3.24 \n", "26 1680577200 10000 0.00 2023-04-04 03:00:00 99 7.25 242 7.65 \n", "27 1680588000 10000 0.00 2023-04-04 06:00:00 99 9.08 251 8.34 \n", "28 1680598800 10000 0.00 2023-04-04 09:00:00 84 11.14 242 13.53 \n", "29 1680609600 10000 0.00 2023-04-04 12:00:00 74 7.78 232 12.84 \n", "30 1680620400 10000 0.00 2023-04-04 15:00:00 45 4.29 237 7.96 \n", "31 1680631200 10000 0.00 2023-04-04 18:00:00 44 1.86 165 2.84 \n", "32 1680642000 10000 0.00 2023-04-04 21:00:00 91 3.76 116 4.85 \n", "33 1680652800 10000 0.00 2023-04-05 00:00:00 95 4.25 86 3.15 \n", "34 1680663600 10000 0.00 2023-04-05 03:00:00 100 1.86 232 5.66 \n", "35 1680674400 10000 0.00 2023-04-05 06:00:00 100 8.68 255 8.99 \n", "36 1680685200 10000 0.00 2023-04-05 09:00:00 100 12.10 224 16.22 \n", "37 1680696000 10000 0.00 2023-04-05 12:00:00 100 10.07 197 17.47 \n", "38 1680706800 10000 0.00 2023-04-05 15:00:00 100 3.89 128 6.64 \n", "39 1680717600 10000 0.00 2023-04-05 18:00:00 100 5.26 115 8.72 \n", "\n", " pod temp ... temp_max pressure sea_level grnd_level humidity \\\n", "0 d 51.21 ... 53.69 1017 1017 1015 53 \n", "1 d 54.70 ... 61.70 1017 1017 1015 49 \n", "2 d 64.56 ... 71.24 1016 1016 1014 32 \n", "3 d 73.65 ... 73.65 1013 1013 1011 19 \n", "4 d 67.26 ... 67.26 1014 1014 1012 27 \n", "5 n 60.53 ... 60.53 1016 1016 1014 41 \n", "6 n 56.41 ... 56.41 1016 1016 1014 50 \n", "7 n 53.76 ... 53.76 1015 1015 1014 54 \n", "8 d 52.20 ... 52.20 1016 1016 1014 56 \n", "9 d 59.56 ... 59.56 1016 1016 1015 48 \n", "10 d 68.27 ... 68.27 1015 1015 1013 41 \n", "11 d 69.60 ... 69.60 1013 1013 1012 37 \n", "12 d 59.90 ... 59.90 1016 1016 1014 42 \n", "13 n 55.36 ... 55.36 1018 1018 1016 50 \n", "14 n 53.73 ... 53.73 1018 1018 1016 53 \n", "15 n 52.18 ... 52.18 1019 1019 1017 61 \n", "16 d 52.02 ... 52.02 1021 1021 1019 63 \n", "17 d 55.94 ... 55.94 1022 1022 1020 53 \n", "18 d 64.38 ... 64.38 1021 1021 1019 36 \n", "19 d 68.11 ... 68.11 1020 1020 1018 31 \n", "20 d 63.88 ... 63.88 1022 1022 1020 39 \n", "21 n 58.35 ... 58.35 1025 1025 1023 55 \n", "22 n 55.42 ... 55.42 1026 1026 1024 64 \n", "23 n 54.05 ... 54.05 1025 1025 1023 70 \n", "24 d 53.02 ... 53.02 1026 1026 1024 74 \n", "25 d 59.70 ... 59.70 1027 1027 1025 57 \n", "26 d 63.14 ... 63.14 1026 1026 1024 50 \n", "27 d 64.96 ... 64.96 1024 1024 1022 46 \n", "28 d 61.70 ... 61.70 1024 1024 1023 59 \n", "29 n 59.09 ... 59.09 1026 1026 1024 64 \n", "30 n 57.22 ... 57.22 1026 1026 1024 67 \n", "31 n 55.63 ... 55.63 1025 1025 1023 72 \n", "32 d 53.91 ... 53.91 1025 1025 1023 74 \n", "33 d 59.68 ... 59.68 1024 1024 1023 53 \n", "34 d 65.70 ... 65.70 1023 1023 1021 38 \n", "35 d 66.72 ... 66.72 1021 1021 1019 46 \n", "36 d 64.62 ... 64.62 1021 1021 1019 52 \n", "37 n 62.26 ... 62.26 1021 1021 1019 58 \n", "38 n 61.54 ... 61.54 1020 1020 1018 58 \n", "39 n 60.28 ... 60.28 1019 1019 1017 62 \n", "\n", " temp_kf id main description icon \n", "0 -1.38 800 Clear clear sky 01d \n", "1 -3.89 800 Clear clear sky 01d \n", "2 -3.71 800 Clear clear sky 01d \n", "3 0.00 800 Clear clear sky 01d \n", "4 0.00 804 Clouds overcast clouds 04d \n", "5 0.00 804 Clouds overcast clouds 04n \n", "6 0.00 804 Clouds overcast clouds 04n \n", "7 0.00 804 Clouds overcast clouds 04n \n", "8 0.00 804 Clouds overcast clouds 04d \n", "9 0.00 804 Clouds overcast clouds 04d \n", "10 0.00 804 Clouds overcast clouds 04d \n", "11 0.00 804 Clouds overcast clouds 04d \n", "12 0.00 804 Clouds overcast clouds 04d \n", "13 0.00 804 Clouds overcast clouds 04n \n", "14 0.00 804 Clouds overcast clouds 04n \n", "15 0.00 804 Clouds overcast clouds 04n \n", "16 0.00 804 Clouds overcast clouds 04d \n", "17 0.00 804 Clouds overcast clouds 04d \n", "18 0.00 801 Clouds few clouds 02d \n", "19 0.00 800 Clear clear sky 01d \n", "20 0.00 800 Clear clear sky 01d \n", "21 0.00 800 Clear clear sky 01n \n", "22 0.00 800 Clear clear sky 01n \n", "23 0.00 800 Clear clear sky 01n \n", "24 0.00 800 Clear clear sky 01d \n", "25 0.00 800 Clear clear sky 01d \n", "26 0.00 804 Clouds overcast clouds 04d \n", "27 0.00 804 Clouds overcast clouds 04d \n", "28 0.00 803 Clouds broken clouds 04d \n", "29 0.00 803 Clouds broken clouds 04n \n", "30 0.00 802 Clouds scattered clouds 03n \n", "31 0.00 802 Clouds scattered clouds 03n \n", "32 0.00 804 Clouds overcast clouds 04d \n", "33 0.00 804 Clouds overcast clouds 04d \n", "34 0.00 804 Clouds overcast clouds 04d \n", "35 0.00 804 Clouds overcast clouds 04d \n", "36 0.00 804 Clouds overcast clouds 04d \n", "37 0.00 804 Clouds overcast clouds 04n \n", "38 0.00 804 Clouds overcast clouds 04n \n", "39 0.00 804 Clouds overcast clouds 04n \n", "\n", "[40 rows x 22 columns]" ] }, "execution_count": 54, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_osaka = get_forecast(lat=34.6937, lon=135.5023, api_key=api_key)\n", "df_osaka" ] } ], "metadata": { "celltoolbar": "Slideshow", "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "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.10.6" } }, "nbformat": 4, "nbformat_minor": 5 }