Six Amazing Unknown Python Libraries
<p>I’ve been using Python extensively for the last two years. As a result, I’m always looking for amazing libraries that can enhance my work in Data Engineering and Business Intelligence projects.</p>
<h1>1. Pendulum</h1>
<p>Although many libraries are available in Python for DateTime, I find Pendulum easy to use on any operation on the dates. A pendulum is my favorite library for my daily usage at my work. It extends the built-in Python datetime module, adding a more intuitive API for handling time zones and performing operations on dates and times like adding time intervals, subtracting dates, and converting between time zones. It provides a simple, human-friendly API for formatting dates and times.</p>
<h1>Installation</h1>
<pre>
!pip install pendulum</pre>
<h1>Example</h1>
<pre>
# import library
import pendulum
dt = pendulum.datetime(2023, 1, 31)
print(dt)
#local() creates datetime instance with local timezone
local = pendulum.local(2023, 1, 31)
print("Local Time:", local)
print("Local Time Zone:", local.timezone.name)
# Printing UTC time
utc = pendulum.now('UTC')
print("Current UTC time:", utc)
# Converting UTC timezone into Europe/Paris time
europe = utc.in_timezone('Europe/Paris')
print("Current time in Paris:", europe)</pre>
<h1>Output</h1>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:525/0*vtSZchPQ-ZsiRPTu.png" style="height:148px; width:700px" /></p>
<h1>2. ftfy</h1>
<p>Have you encountered when the foreign language present in the data does not appear correctly? This is called Mojibake. Mojibake is a term used to describe garbled or scrambled text that occurs as a result of encoding or decoding problems. It typically occurs when text that was written in one character encoding is incorrectly decoded using a different encoding. ftfy python library will help you fix the Mojibake, which is very useful in NLP use cases.</p>
<p><a href="https://medium.com/@Divithraju/six-amazing-unknown-python-libraries-c7bdad6b4472">Visit Now</a></p>