Python tutorials

Guide to Flask-MongoEngine in Python

Introduction Building a web app almost always means dealing with data from a database. There are various databases to choose from, depending on your preference. In this guide, we shall be taking a look at how to integrate one of the most popular NoSQL databases – MongoDB – with the Flask micro-framework. In this guide, we’ll be exploring how to integrate MongoDB with Flask using a popular library – MongoEngine, and more specifically, its wrapper – Flask-MongoEngine. Alternatively, you can […]

Read more

Sentiment Analysis: VADER or TextBlob?

This article was published as a part of the Data Science Blogathon. What Is Sentiment Analysis? Conclusions are integral to practically all human exercises and are key influencers of our practices. Our convictions and impression of the real world, and the decisions we make, are, to an impressive degree, molded upon how others see and assess the world. Therefore, when we have to settle on a choice, we regularly search out the assessments of others. Opinions and their related concepts […]

Read more

Sentiment Analysis: Predicting Sentiment Of COVID-19 Tweets

This article was published as a part of the Data Science Blogathon. Introduction Hi folks, I hope you are doing well in these difficult times! We all are going through the unprecedented time of the Corona Virus pandemic. Some people lost their lives, but many of us successfully defeated this new strain i.e. Covid-19. The virus was declared a pandemic by World Health Organization on 11th March 2020. This article will analyze various types of “Tweets” gathered during pandemic times. […]

Read more

Python: Get Number of Days Between Dates

Introduction In this tutorial, we’ll take a look at how to get the number of days between two dates in Python. We’ll be using the built-in datetime package, that allows you to really easily work with datetime objects in Python. Creating a Datetime Object As datetime is a built-in module, you can access it right away by importing it at the top of your Python file. You can construct datetime objects in a few different ways: from datetime import datetime […]

Read more

Python: Check if Variable is a Dictionary

Introduction Variables act as a container to store data. A developer can use type hints when creating variables or passing arguments, however, that’s an optional feature in Python, and many codebases, old and new, are yet to have them. It’s more common for a variable in Python to have no information of the type being stored. If we had code that needed a dictionary but lacked type hints, how can we avoid errors if the variable used is not a […]

Read more

Python: How to Add Key to a Dictionary

Introduction A dictionary in Python is a collection of items that store data as key-value pairs. We can access and manipulate dictionary items based on their key. Dictionaries are mutable and allow us to add new items to them. The quickest way to add a single item to a dictionary is by using referencing a dictionary’s index with a new key and assigning a value. For example, we add a new key-value pair like this: snacks[‘chocolate’] = 5 Python allows […]

Read more

Python: How to Remove a Key from a Dictionary

Introduction In this article, we’ll take a look at how to remove keys from Python dictionaries. This can be done with the pop() function, the del keyword, and with dict comprehensions. Remove a Key Using pop(key,d) The pop(key, d) function removes a key from a dictionary and returns its value. It takes two arguments, the key is removed and the optional value to return if the key isn’t found. Here’s an example of popping an element with only the required […]

Read more

Introduction to Hugging Face’s Transformers v4.3.0 and its First Automatic Speech Recognition Model – Wav2Vec2

Overview Hugging Face has released Transformers v4.3.0 and it introduces the first Automatic Speech Recognition model to the library: Wav2Vec2 Using one hour of labeled data, Wav2Vec2 outperforms the previous state of the art on the 100-hour subset while using 100 times less labeled data Using just ten minutes of labeled data and pre-training on 53k hours of unlabeled data Wav2Vec2 achieves 4.8/8.2 WER Understand Wav2Vec2 implementation using transformers library on audio to text generation   Introduction Transformers has been […]

Read more

Covariance and Correlation in Python

Introduction Working with variables in data analysis always drives the question: How are the variables dependent, linked, and varying against each other? Covariance and Correlation measures aid in establishing this. Covariance brings about the variation across variables. We use covariance to measure how much two variables change with each other. Correlation reveals the relation between the variables. We use correlation to determine how strongly linked two variables are to each other. In this article, we’ll learn how to calculate the […]

Read more

How to Rename Pandas DataFrame Column in Python

Introduction Pandas is a Python library for data analysis and manipulation. Almost all operations in pandas revolve around DataFrames. A Dataframe is is an abstract representation of a two-dimensional table which can contain all sorts of data. They also enable us give all the columns names, which is why oftentimes columns are referred to as attributes or fields when using DataFrames. In this article we’ll see how we can rename an already existing DataFrame‘s columns. There are two options for […]

Read more
1 129 130 131 132 133 181