Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Read by thought-leaders and decision-makers around the world. Phone Number: +1-650-246-9381 Email: [email protected]
228 Park Avenue South New York, NY 10003 United States
Website: Publisher: https://towardsai.net/#publisher Diversity Policy: https://towardsai.net/about Ethics Policy: https://towardsai.net/about Masthead: https://towardsai.net/about
Name: Towards AI Legal Name: Towards AI, Inc. Description: Towards AI is the world's leading artificial intelligence (AI) and technology publication. Founders: Roberto Iriondo, , Job Title: Co-founder and Advisor Works for: Towards AI, Inc. Follow Roberto: X, LinkedIn, GitHub, Google Scholar, Towards AI Profile, Medium, ML@CMU, FreeCodeCamp, Crunchbase, Bloomberg, Roberto Iriondo, Generative AI Lab, Generative AI Lab Denis Piffaretti, Job Title: Co-founder Works for: Towards AI, Inc. Louie Peters, Job Title: Co-founder Works for: Towards AI, Inc. Louis-François Bouchard, Job Title: Co-founder Works for: Towards AI, Inc. Cover:
Towards AI Cover
Logo:
Towards AI Logo
Areas Served: Worldwide Alternate Name: Towards AI, Inc. Alternate Name: Towards AI Co. Alternate Name: towards ai Alternate Name: towardsai Alternate Name: towards.ai Alternate Name: tai Alternate Name: toward ai Alternate Name: toward.ai Alternate Name: Towards AI, Inc. Alternate Name: towardsai.net Alternate Name: pub.towardsai.net
5 stars – based on 497 reviews

Frequently Used, Contextual References

TODO: Remember to copy unique IDs whenever it needs used. i.e., URL: 304b2e42315e

Resources

Take our 85+ lesson From Beginner to Advanced LLM Developer Certification: From choosing a project to deploying a working product this is the most comprehensive and practical LLM course out there!

Publication

Five Cool Python Libraries for Data Science
Data Science

Five Cool Python Libraries for Data Science

Last Updated on May 23, 2020 by Editorial Team

Author(s):Β Dhilip Subramanian

Handy Python libraries for data science

Python is a best friend for the majority of the Data Scientists. Libraries make their life simpler. I have come across five cool Python libraries while working on my NLP project. This helped me a lot and I would like to share the same in this article.

1. Numerizer

Amazing library to convert text numerics into int and float. Useful library for NLP projects. For more details, please check PyPI and thisΒ github repo.

Installation

!pip install numerizer

Example

#importing numerize library
from numerizer import numerize#examplesprint(numerize(β€˜Eight fifty million’))
print(numerize(β€˜one two three’))
print(numerize(β€˜Fifteen hundred’))
print(numerize(β€˜Three hundred and Forty five’))
print(numerize(β€˜Six and one quarter’))
print(numerize(β€˜Jack is having fifty million’))
print(numerize(β€˜Three hundred billion’))

Output


2. Missingo

It is widespread to find missing values in a real-world dataset. We need to understand the missing values before imputing. Missingo offers a quick and helpful way to visualize the missing values.

Installation

!pip install missingno

Usage

# importing necessary libraries
import pandas as pd 
import missingno as mi# reading the dummy dataset
data = pd.read_excel(β€œdummy.xlsx”)# checking missing values
data.isnull().sum()

Dummy dataset has 11 rows and four columns. Missing values presented in Min, Temp, and city variables. We can visualize using a bar graph and matrix. It also supports heatmap, dendrogram. For more details, please check thisΒ Github repository.

#Visualizing using missingoprint(β€œVisualizing missing value using bar graph”)
mi.bar(data, figsize = (10,5))print(β€œVisualizing missing value using matrix”)
mi.matrix(data, figsize = (10,5) )

Output

We can see the missing values in temp, min, and city from the above bar graph and matrix.


3. Faker

We might come across a situation where we need to generate some test data or use some dummy data in our analysis.Β One way to get dummy data is by using the Faker library. This will generate fake data for you very quickly when you need to.

Installation

!pip install faker

Example

# Generating fake email
print (fake.email()) 
# Generating fake country name
print(fake.country()) 
# Generating fake name
print(fake.name()) 
# Generating fake text
print(fake.text()) 
# Generating fake lat and lon
print(fake.latitude(), fake.longitude())
# Generating fake url
print(fake.url()) 
# Generating fake profile
print(fake.profile())
# Generating random number
print(fake.random_number())

Output

It generates fake data for various categories, and please check this link for moreΒ details.


4. EMOT

Collecting and analyzing data on emojis as well as emoticons give useful insights, especially in sentiment analysis. AnΒ emojiΒ is an image small enough to insert into text that expresses an emotion or idea. AnΒ emoticonΒ is a representation of a human facial expression using only keyboard characters such as letters, numbers, and punctuation marks.

emotΒ helped us to convert the emojis and emoticons into words. For more details on this library, please check thisΒ Github repo. It has a good collection of emoticons and emojis with the corresponding words.

Installation

!pip install emot

Usage

#Importing libraries
import re
from emot.emo_unicode import UNICODE_EMO, EMOTICONS# Function for converting emojis into word
def convert_emojis(text):
    for emot in UNICODE_EMO:
        text = text.replace(emot, "_".join(UNICODE_EMO[emot].replace(",","").replace(":","").split()))
    return text# Example
text1 = "Hilarious πŸ˜‚. The feeling of making a sale 😎, The feeling of actually fulfilling orders πŸ˜’"
convert_emojis(text1)

Output

β€˜Hilarious face_with_tears_of_joy. The feeling of making a sale smiling_face_with_sunglasses, The feeling of actually fulfilling orders unamused_face’

Emoticon into word form

Usage

# Function for converting emoticons into word
def convert_emoticons(text):
    for emot in EMOTICONS:
        text = re.sub(u'('+emot+')', "_".join(EMOTICONS[emot].replace(",","").split()), text)
    return text# Example
text = "Hello :-) :-)"
convert_emoticons(text)

Output

'Hello Happy_face_smiley Happy_face_smiley'

5. Chartify

Chartify is a visualization library that aims to make it as easy as possible for data scientists to create charts. It comes with user-friendly syntax and consistent data formatting compared to other tools. It takes less time to create beautiful and quick charts. This was developed by Spotify labs.

Here, I am showing only the bar chart.Β For more details and charts, please check thisΒ documentationΒ andΒ notebook

Installation

!pip install chartify

Usage

# importing necessary libraryimport numpy as np
import pandas as pd
import chartify#loading example dataset from chartify
data = chartify.examples.example_data()
data.head()
# Calculating total quanity for each fruits
quantity_by_fruit = (data.groupby(β€˜fruit’)[β€˜quantity’].sum().reset_index())
ch = chartify.Chart(blank_labels=True, x_axis_type=’categorical’)
ch.set_title(β€œVertical bar plot”)
ch.set_subtitle(β€œAutomatically sorts by value counts.”)
ch.plot.bar(
 data_frame=quantity_by_fruit,
 categorical_columns=’fruit’,
 numeric_column=’quantity’)
ch.show()

Output

You can save the chart by clicking the save icon at the top right of the chart.


Thanks for reading. If you have anything to add, please feel free to leave a comment!

You can also read this article onΒ KDnuggets.

Feedback ↓