How to make all words to lower case in python

This recipe helps you make all words to lower case in python using lower function

Recipe Objective

In Content Analysis or text Analysis we want same format of our text or content for better analysis and to get a better output, for e.g No special characters should be there, All the text should be in same case (Upper or lower). So now we are going to see how to make all words to lower case in a text.

Getting Started with Image Segmentation using Mask R-CNN

Step 1 - Take a Simple word and store it in a variable

My_word = "LANGUAGE" print(My_word)

LANGUAGE

So here we have taken a word, and stored it in a variable called My_word. As we can see the word is in Upper case so lets try to make it in lower case.

Step 2 - Converting upper case word to lower case

print("The lower case word is :",My_word.lower())

The lower case word is : language

here we can see the word has totally been converted into lower case, python has a inbuilt function called lower which converts the Upper case letters to lower case.

Step 3 - Lets try with a sentence

My_sentence = "Harry is 12 YEARS OLD, and he LOVES to Play 'FOOTBALL'." print("Lets see what changes has happened :", My_sentence.lower())

Lets see what changes has happened : harry is 12 years old, and he loves to play 'football'.

As we can see that, the letters which were in upper case has been converted into lower case though some words like football was in quotes still has been converted into lower case.

What Users are saying..

profile image

Jingwei Li

Graduate Research assistance at Stony Brook University
linkedin profile url

ProjectPro is an awesome platform that helps me learn much hands-on industrial experience with a step-by-step walkthrough of projects. There are two primary paths to learn: Data Science and Big Data.... Read More

Relevant Projects

Isolation Forest Model and LOF for Anomaly Detection in Python
Credit Card Fraud Detection Project - Build an Isolation Forest Model and Local Outlier Factor (LOF) in Python to identify fraudulent credit card transactions.

Azure Deep Learning-Deploy RNN CNN models for TimeSeries
In this Azure MLOps Project, you will learn to perform docker-based deployment of RNN and CNN Models for Time Series Forecasting on Azure Cloud.

Build a Hybrid Recommender System in Python using LightFM
In this Recommender System project, you will build a hybrid recommender system in Python using LightFM .

Ola Bike Rides Request Demand Forecast
Given big data at taxi service (ride-hailing) i.e. OLA, you will learn multi-step time series forecasting and clustering with Mini-Batch K-means Algorithm on geospatial data to predict future ride requests for a particular region at a given time.

Digit Recognition using CNN for MNIST Dataset in Python
In this deep learning project, you will build a convolutional neural network using MNIST dataset for handwritten digit recognition.

Build Deep Autoencoders Model for Anomaly Detection in Python
In this deep learning project , you will build and deploy a deep autoencoders model using Flask.

Learn to Build an End-to-End Machine Learning Pipeline - Part 2
In this Machine Learning Project, you will learn how to build an end-to-end machine learning pipeline for predicting truck delays, incorporating Hopsworks' feature store and Weights and Biases for model experimentation.

End-to-End Snowflake Healthcare Analytics Project on AWS-2
In this AWS Snowflake project, you will build an end to end retraining pipeline by checking Data and Model Drift and learn how to redeploy the model if needed

Build a Churn Prediction Model using Ensemble Learning
Learn how to build ensemble machine learning models like Random Forest, Adaboost, and Gradient Boosting for Customer Churn Prediction using Python

Build Portfolio Optimization Machine Learning Models in R
Machine Learning Project for Financial Risk Modelling and Portfolio Optimization with R- Build a machine learning model in R to develop a strategy for building a portfolio for maximized returns.