<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>library Archives - Artificial Intelligence</title>
	<atom:link href="https://www.aiuniverse.xyz/tag/library/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.aiuniverse.xyz/tag/library/</link>
	<description>Exploring the universe of Intelligence</description>
	<lastBuildDate>Fri, 19 Mar 2021 06:45:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Complete Guide To Arrow: A Python Library for User-friendly Handling Of Dates, Time and Timestamps</title>
		<link>https://www.aiuniverse.xyz/complete-guide-to-arrow-a-python-library-for-user-friendly-handling-of-dates-time-and-timestamps/</link>
					<comments>https://www.aiuniverse.xyz/complete-guide-to-arrow-a-python-library-for-user-friendly-handling-of-dates-time-and-timestamps/#respond</comments>
		
		<dc:creator><![CDATA[aiuniverse]]></dc:creator>
		<pubDate>Fri, 19 Mar 2021 06:45:21 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Dates]]></category>
		<category><![CDATA[FRIENDLY]]></category>
		<category><![CDATA[Handling]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[Timestamps]]></category>
		<guid isPermaLink="false">http://www.aiuniverse.xyz/?p=13624</guid>

					<description><![CDATA[<p>Source &#8211; https://analyticsindiamag.com/ Arrow is a flexible Python library designed to create, format, manipulate, and convert dates, time, and timestamps in a sensible and human-friendly manner. It <a class="read-more-link" href="https://www.aiuniverse.xyz/complete-guide-to-arrow-a-python-library-for-user-friendly-handling-of-dates-time-and-timestamps/">Read More</a></p>
<p>The post <a href="https://www.aiuniverse.xyz/complete-guide-to-arrow-a-python-library-for-user-friendly-handling-of-dates-time-and-timestamps/">Complete Guide To Arrow: A Python Library for User-friendly Handling Of Dates, Time and Timestamps</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Source &#8211; https://analyticsindiamag.com/</p>



<p>Arrow is a flexible Python library designed to create, format, manipulate, and convert dates, time, and timestamps in a sensible and human-friendly manner. It provides an intelligent module API that allows dealing with dates and times with a few code lines and imports. The library is named after the “time’s arrow” concept suggesting the one-directional progress of time. It is inspired by Requests (an HTTP library) and Moment.js (a JavaScript date library).</p>



<h2 class="wp-block-heading" id="h-why-arrow">Why Arrow?</h2>



<p>Standard Python library and low-level conventional modules are available for the various date and time functionalities but have the following limitations from a user’s point of view:</p>



<ul class="wp-block-list"><li>Too many modules available such as time, datetime, dateutil, calendar and pytz</li><li>A large number of data types to choose from such as datetime, date, time, timedelta, tzinfo and so on</li><li>Users may lack experience in handling different time zones</li><li>Inefficient ways of timestamps and timezone conversions</li><li>Gaps in functionalities such as humanization (e.g. converting a date into human-readable format) and ISO 8601 parsing</li></ul>



<h2 class="wp-block-heading" id="h-highlighting-features-of-arrow">Highlighting Features of Arrow</h2>



<ul class="wp-block-list"><li>Supports Python 3.6+ versions</li><li>A fully-implemented, efficient alternative to datetime standard library</li><li>Aware of timezones (uses UTC (Coordinated Universal Time) by default) and enables easy timezone conversion.</li><li>Automatic formatting and parsing of strings</li><li>Widely supports ISO 8601 standard date and time format. </li><li>Supports pytz, ZoneInfo and dateutil objects</li><li>Can generate floors, ceilings, spans and ranges for time frames ranging from microseconds to years</li><li>Can be extended to users’ own Arrow-derived datatypes</li><li>Supports PEP 484-style type hints</li></ul>



<h2 class="wp-block-heading" id="h-installing-arrow">Installing Arrow</h2>



<p>Install Arrow using pip command as follows:</p>



<p><code>pip install -U arrow</code></p>



<h2 class="wp-block-heading" id="h-practical-implementation">Practical Implementation</h2>



<p>Here’s a demonstration of performing various operations using Arrow. The experiments have been done in Google colab with Python version3.7.10. Explanation of each operation along with its output is as follows:</p>



<p>First, import the Arrow library</p>



<p><code>import arrow as arw</code></p>



<ol class="wp-block-list"><li>Represent current time in the given timezone</li></ol>



<p><code>arw.now()</code></p>



<p>With no timezone specified, an Arrow object representing current UTC time will be created. Same output results on executing</p>



<p><code>arw.utcnow()</code></p>



<p><strong>Output:</strong>&nbsp;<code>&lt;Arrow [2021-03-16T10:39:26.746385+00:00]&gt;</code></p>



<p>To get current time in say US/Pacific timezone:</p>



<p><code>arw.now(‘US/Pacific’)</code></p>



<p><strong>Output:&nbsp;</strong><code>&lt;Arrow [2021-03-16T03:48:10.893440-07:00]&gt;</code></p>



<ol class="wp-block-list" start="2"><li>Convert a specified integer or float number into a floating-point UTC timestamp</li></ol>



<p><code>arw.get(1567900664)</code></p>



<p><strong>Output:</strong>&nbsp;<code>&lt;Arrow [2019-09-07T23:57:44+00:00]&gt;</code></p>



<pre class="wp-block-preformatted"> #Try with a floating point input
 arw.get(17900664.5463877) </pre>



<p><strong>Output:</strong>&nbsp;<code>&lt;Arrow [1970-07-27T04:24:24.546388+00:00]&gt;</code></p>



<p>Verify the converted output here.</p>



<ol class="wp-block-list" start="3"><li>String parsing</li></ol>



<p><code>arw.get('12-03-2020 22:30:25', 'MM-DD-YYYY HH:mm:ss')</code></p>



<p>Specified date and time will be represented as MM-DD-YYYY HH:mm:ss&nbsp;</p>



<p>format</p>



<p><strong>Output:</strong>&nbsp;<code>&lt;Arrow [2020-12-03T22:30:25+00:00]&gt;</code></p>



<ol class="wp-block-list" start="4"><li>Extract date from a string</li></ol>



<p><code>arw.get('I was born on March 12 1990','MMMM DD YYYY')</code></p>



<p>‘MMMM DD YYYY’ formatted date will be searched in the string</p>



<p><strong>Output:</strong>&nbsp;<code>&lt;Arrow [1990-03-12T00:00:00+00:00]&gt;</code></p>



<ol class="wp-block-list" start="5"><li>Instantiate Arrow object by directly providing a datetime argument</li></ol>



<p><code>arw.Arrow(2020,12,26)</code></p>



<p><strong>Output:</strong>&nbsp;<code>&lt;Arrow [2020-12-26T00:00:00+00:00]&gt;</code></p>



<ol class="wp-block-list" start="6"><li>Get a datetime representation an Arrow object</li></ol>



<p><code>x = arw.now()</code></p>



<p>Suppose, x is&nbsp;<code>&lt;Arrow [2021-03-16T11:49:17.908895+00:00]&gt;</code></p>



<p><code>x.datetime</code></p>



<p><strong>Output:</strong>&nbsp;<code>datetime.datetime(2021, 3, 16, 11, 49, 17, 908895, tzinfo=tzlocal())</code></p>



<p>The components can then be separated as:</p>



<p><code>x.month&nbsp;</code>&nbsp;&nbsp;&nbsp;</p>



<p><strong>Output:</strong>&nbsp;<code>3</code></p>



<p><code>x.year</code></p>



<p><strong>Output:</strong>&nbsp;<code>2021</code></p>



<p><code>x.day</code></p>



<p><strong>Output:</strong>&nbsp;<code>16</code></p>



<p><code>x.hour</code></p>



<p><strong>Output:</strong>&nbsp;<code>11</code></p>



<p>Datetime functions can be called to get properties of the Arrow object</p>



<p><code>x.time()</code></p>



<p><strong>Output:</strong>&nbsp;<code>datetime.time(11, 49, 17, 908895)</code></p>



<ol class="wp-block-list" start="7"><li>Replace one or more components of the Arrow object</li></ol>



<p><code>a = arw.now()</code></p>



<p>Suppose, ‘a’ is&nbsp;<code>&lt;Arrow [2021-03-16T12:00:13.500164+00:00]&gt;</code></p>



<p><code>a.replace(year=2019, second=45, month=11)</code></p>



<p>will give the&nbsp;<strong>output:</strong>&nbsp;<code>&lt;Arrow [2019-11-16T12:00:45.500164+00:00]&gt;</code></p>



<ol class="wp-block-list" start="8"><li>One or more Arrow object attributes can be shifted forward or backward</li></ol>



<p><code>present = arw.now()</code></p>



<p>Suppose, ‘present’ object is&nbsp;<code>&lt;Arrow [2021-03-16T12:08:34.530495+00:00]&gt;</code></p>



<p>Go forward in time by 2 years</p>



<p><code>present.shift(years=+2)</code></p>



<p><strong>Output:</strong>&nbsp;<code>&lt;Arrow [2023-03-16T12:08:34.530495+00:00]&gt;</code></p>



<p>Go backward by 4 hours</p>



<p><code>present.shift(hours=-4)</code></p>



<p><strong>Output</strong>:&nbsp;<code>&lt;Arrow [2021-03-16T08:08:34.530495+00:00]&gt;</code></p>



<ol class="wp-block-list" start="9"><li>Represent date and time in the required format</li></ol>



<p><code>arw.now().format('HH:MM:SS MM:DD:YYYY')</code></p>



<p><strong>Output:</strong>&nbsp;<code>12:03:00 03:16:2021</code></p>



<p>(i.e. 12 hrs 3 mins 00 sec, 16 March 2021)</p>



<ol class="wp-block-list" start="10"><li>Convert default UTC to specified timezone&nbsp;</li></ol>



<p><code>utc = arw.utcnow()</code></p>



<p>Suppose, utc is&nbsp;<code>&lt;Arrow [2021-03-16T12:20:43.301159+00:00]&gt;</code></p>



<p>It can be converted to US/Pacific time zone as follows:</p>



<p><code>utc.to('US/Pacific')</code></p>



<p><strong>Output:</strong> <code>&lt;Arrow [2021-03-16T05:20:43.301159-07:00]></code></p>



<ol class="wp-block-list" start="11"><li>Humanization examples</li></ol>



<p>Humanize relative to current time:</p>



<pre class="wp-block-preformatted"> future = arw.now().shift(minutes=+2)  #advance by 2 mins
 future.humanize() </pre>



<p><strong>Output:</strong>&nbsp;<code>‘in 2 minutes’</code></p>



<p>Humanize relative to another datetime or Arrow object</p>



<pre class="wp-block-preformatted"> present = arw.now()&nbsp; #current time
 future = present.shift(days=-3)&nbsp; #go back by 3 days
 #how far is present from future
 future.humanize(present)&nbsp; </pre>



<p><strong>Output:</strong>&nbsp;<code>‘3 days ago’</code></p>



<pre class="wp-block-preformatted"> #how far is future from present
 present.humanize(future)&nbsp; </pre>



<p><strong>Output:</strong>&nbsp;<code>‘in 3 days’</code></p>



<p>To get only the distance:</p>



<p><code>future.humanize(present, only_distance=True)&nbsp;</code></p>



<p><strong>Output:</strong>&nbsp;<code>‘3 days’</code></p>



<p>Indicate time difference in terms of one or more specific time granularities like hours,&nbsp;&nbsp;</p>



<p>&nbsp;minutes etc.</p>



<p><code>future.humanize(present, granularity="minute")</code></p>



<p><strong>Output:</strong>&nbsp;<code>‘4320 minutes ago’</code>&nbsp; #3 days equals 4320 mins</p>



<p>Multiple granularities can be specified as:</p>



<p><code>future.humanize(present, granularity=["minute","second"])</code></p>



<p><strong>Output:</strong>&nbsp;<code>‘in 4320 minutes and 0 seconds’</code></p>



<ol class="wp-block-list" start="12"><li>Get the span of any time unit</li></ol>



<p><code>arw.now().span(‘minute’) </code> </p>



<p><strong>Output:</strong></p>



<pre class="wp-block-preformatted"> (&lt;Arrow [2021-03-16T12:58:00+00:00]&gt;,
 &nbsp;&lt;Arrow [2021-03-16T12:58:59.999999+00:00]&gt;) </pre>



<p><code>arw.now().span('day')&nbsp; #get the span of time for a whole day</code></p>



<p><strong>Output:</strong></p>



<pre class="wp-block-preformatted"> (&lt;Arrow [2021-03-16T00:00:00+00:00]&gt;,
 &nbsp;&lt;Arrow [2021-03-16T23:59:59.999999+00:00]&gt;) </pre>



<ol class="wp-block-list" start="13"><li>Get floor and ceiling values of a specific time component</li></ol>



<p><code>arw.now().floor('minute')</code></p>



<p><strong>Output:</strong>&nbsp;<code>&lt;Arrow [2021-03-16T13:04:00+00:00]&gt;</code></p>



<p><code>arw.now().ceil('minute')</code></p>



<p><strong>Output:</strong>&nbsp;<code>&lt;Arrow [2021-03-16T13:04:59.999999+00:00]&gt;</code></p>



<ol class="wp-block-list" start="14"><li>Get the range of specified timespans</li></ol>



<pre class="wp-block-preformatted"> import datetime
 begin = datetime.datetime(2020, 6, 5, 2, 30) #start time
 end = datetime.datetime(2020, 6, 5, 4, 50)  #end time
 for r in arw.Arrow.range('hour', begin, end):  #iterate in terms of hour
     print(r) </pre>



<p>We want time from 2:30 to 4:50 at the interval of an hour so output will contain 2:30, 3:30 and 4:30 times.</p>



<p><strong>Output:</strong></p>



<pre class="wp-block-preformatted"> 2020-06-05T02:30:00+00:00
 2020-06-05T03:30:00+00:00
 2020-06-05T04:30:00+00:00 </pre>



<ol class="wp-block-list" start="15"><li>FACTORIES can be used for utilizing Arrow’s module API to create a custom Arrow-derive type.</li></ol>



<p>Suppose, we need to find difference in terms of days between today and the Christmas day. We can define a custom class as:</p>



<pre class="wp-block-preformatted"> class Custom(arw.Arrow):&nbsp; #pass an Arrow object
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def till_christmas(self):&nbsp; #define a function for computation
 &nbsp;&nbsp;#store christmas day of given year
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;christmas = arw.Arrow(self.year, 12, 25)
 “””
 If given date falls comes after Christmas of that year, compute its difference w.r.t. Christmas of the next year
 “””
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if self &gt; christmas:
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;christmas = christmas.shift(years=1)
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (christmas - self).days&nbsp; #return the difference </pre>



<pre class="wp-block-preformatted"> f = arw.ArrowFactory(Custom) #Create a factory
 x = f.now()  #current date and time </pre>



<p>Suppose, x is&nbsp;<code>&lt;Custom [2021-03-16T13:21:09.741500+00:00]&gt;</code></p>



<p>Call the till_christmas() method to compute the difference&nbsp;</p>



<p><code>x.till_christmas()</code></p>



<p><strong>Output:</strong>&nbsp;<code>283</code></p>



<p>i.e. Christmas of the year 2021 is 283 days away from 16 March 2021.</p>
<p>The post <a href="https://www.aiuniverse.xyz/complete-guide-to-arrow-a-python-library-for-user-friendly-handling-of-dates-time-and-timestamps/">Complete Guide To Arrow: A Python Library for User-friendly Handling Of Dates, Time and Timestamps</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aiuniverse.xyz/complete-guide-to-arrow-a-python-library-for-user-friendly-handling-of-dates-time-and-timestamps/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Reptiles rule at Shelley library</title>
		<link>https://www.aiuniverse.xyz/reptiles-rule-at-shelley-library/</link>
					<comments>https://www.aiuniverse.xyz/reptiles-rule-at-shelley-library/#respond</comments>
		
		<dc:creator><![CDATA[aiuniverse]]></dc:creator>
		<pubDate>Mon, 10 Jun 2019 10:30:49 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[Reptiles]]></category>
		<category><![CDATA[rule]]></category>
		<category><![CDATA[Shelley]]></category>
		<guid isPermaLink="false">http://www.aiuniverse.xyz/?p=3686</guid>

					<description><![CDATA[<p>Source:- postregister.com SHELLEY – Reptiles are amazing — just ask the more than 300 kids, parents and patrons who attended the “Joanna and Friends Reptile Show” Wednesday afternoon <a class="read-more-link" href="https://www.aiuniverse.xyz/reptiles-rule-at-shelley-library/">Read More</a></p>
<p>The post <a href="https://www.aiuniverse.xyz/reptiles-rule-at-shelley-library/">Reptiles rule at Shelley library</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Source:- postregister.com</p>
<p>SHELLEY – Reptiles are amazing — just ask the more than 300 kids, parents and patrons who attended the “Joanna and Friends Reptile Show” Wednesday afternoon at the North Bingham County District Library in Shelley.</p>
<p>Tortoises, snakes and lizards were handled by Tyler and Heather Olsen, with the help of their children — Zodia, Azdyn and Xzavion. Olsen, as master-of-ceremonies, explained some of the characteristics of each animal — what they eat and how they defend themselves.</p>
<p>The one-hour show was as enjoyable as it was educational.</p>
<div id="tncms-region-article_instory_top" class="tncms-region hidden-print"></div>
<p>The star of the show is Joanna, a monitor lizard.</p>
<p>“She was named after the lizard in the Disney movie, ‘Rescuers Down Under,’” Olsen said. “These monitor lizards are scavengers. We feed Joanna a turkey meatloaf. We throw in the whole egg, including the egg shell. She gets her calcium from the egg shells. She is like a pet dog; she likes to be held and petted.”</p>
<p>Asked how they started their reptile menagerie, Olsen said, “My kids like unusual animals.”</p>
<p>Some of these animals included the first animal purchased by the Olsen family in 2011. It was a Russian tortoise.</p>
<p>Some of the differences between a tortoise and turtle are a tortoise cannot draw back its head and appendages completely into its shell whereas a turtle can. A tortoise has nails at the end of its feet; a turtle’s feet are webbed. Both species have shells made from keratin, the same material as a person’s fingernails and, yes, a tortoise or turtle can feel when they are petted as a person strokes its shell.</p>
<p>The bearded dragon is from Australia and has spikes for defense.</p>
<p>“The spikes are decoys,” Olsen said. “The dragon has a puffy neck that it blows up for defense. It makes the dragon look a lot bigger. As babies, the dragon eats insects; when it becomes an adult, it is a vegetarian.”</p>
<p>Olsen continued, “Meet our dinosaur. This lizard, named ‘Spike,’ is a Niger Uromastyxs. His tail is his defensive weapon of choice. He will crawl into cracks in the ground and then puff himself up; he uses his tail like a whip. He eats bird seed and beans, legumes. He normally lives in the Sahara Desert and does not drink water; he absorbs humidity from the air. His coloring can be black and yellow, black and orange, or green and purple.”</p>
<p>Mushu, the mangeral monitor lizard, can grow from four to seven feet long. These lizards climb trees and live from 20-30 years. They are strict carnivores and excellent swimmers.</p>
<p>“Lizards and snakes eat their food in one gulp,” Olsen said.</p>
<p>Periwinkle, the white ball python, can grow to six feet long. She is not an albino python; she has white coloring. Her eyes are blue whereas an albino’s eyes are red.</p>
<div id="tncms-region-article_instory_middle" class="tncms-region hidden-print"></div>
<p>“Ball pythons were popular in ancient Egypt where they were worn as jewelry,” Olsen said. “They are picky eaters; they eat lizards, birds, and some of them can be trained to eat frozen mice.</p>
<p>“If you are interested in making a reptile a pet, know that it’s a longtime commitment,” he said. “Lizards live between 15-20 years, snakes live 15-40 years. Reptiles cannot be domesticated, like a dog or cat. They spend most of their lives in hiding.”</p>
<p>At the conclusion of the show, children and their parents lined up to be able to pet a desert tortoise, two lizards, a ball python, and Joanna, the monitor lizard.</p>
<p>“Pet the animals from their nose to their tail,” Olsen advised.</p>
<p>Parents reported they brought their children to the reptile show so their children could see reptiles.</p>
<p>“I liked all the facts they told us,” one young lady said.</p>
<p>The Joanna and Friends Reptile Show can also be hired for parties. As it says on their card, they can “bring the party animals to you.”</p>
<p>The post <a href="https://www.aiuniverse.xyz/reptiles-rule-at-shelley-library/">Reptiles rule at Shelley library</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aiuniverse.xyz/reptiles-rule-at-shelley-library/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
