When developing your application, you may need to overcome some tasks involving counting the elements in a container object. You may need to count word frequencies in a text or you may want to know the most frequently used number in a list object. For such cases, Python provides a handy tool in its collections module, a built-in class called Counter().
In this short article, I will try to explain how to use Counter class with easy to understand examples for beginners.
You can find below the explanation of the Counter class at docs.python.org
With easy to follow examples for beginners
Python comes with many specialised data types. In this article, I will try to explain NamedTuples by providing easy-to-follow examples for the beginners.
NamedTuple is basically an extension of the Python built-in tuple data type. Here is how doc.python.org defines the NamedTuples;
Named tuples assign meaning to each position in a tuple and allow for more readable, self-documenting code. They can be used wherever regular tuples are used, and they add the ability to access fields by name instead of position index
To understand NamedTuples further, let’s first recall what the Python tuples…
There are many built-in data types in Python. Each data type has downsides and advantages depending on the use case. So, knowing the strengths and weaknesses of each data type is key to develop efficient applications.
In this article, I will try to explain deque data types in Python.
Deque is short for the double-ended queue which means that it efficiently supports adding and removing items from both ends. They are designed to perform these specific tasks efficiently.
Deques are not so different than the lists, stacks and queues. …
Lists and dictionaries are the most widely used built-in data types in Python. This makes them also the best-known data types in Python. When it comes to tuples, grasping the details of how they differ from the lists is not an easy task for the beginners as they are very similar to each other.
In this article, I will explain key differences by providing examples for various use cases to better explain when to use tuples over lists.
If you’ve heard of lambda functions in Python but not sure about how to use them, you’re in the right place.
This article will provide all you need to know about the lambda functions in Python:
Lambda functions are defined without a name so they are also called anonymous or nameless functions. …
If you aim to develop an e-learning platform, the first difficulty you have to overcome will probably be creating the course content. Unfortunately, creating course content is the most challenging part of the development process as it consumes a lot of time and energy. Fortunately, this process can be automated with the help of web scraping and natural language processing.
In this post, I will show you step by step how such automation can be achieved using spaCy. …
Not only money, more than money!
I will start with a fundamental question.
Why did I start writing on Medium, in my early forties with no writing experience at all?
I would like to say the reason is to share my knowledge to help others. But I will be honest about this, let me list what really motivates me to write;
In this article, I will try to explain Python lists, along with exploring why and when to use them, meanwhile giving you some hints about the correct usage of the list methods.
Let’s understand the Python list data structure in detail with step by step explanations and examples.
Lists are one of the most frequently used built-in data structures in Python. You can create a list by placing all the items inside square brackets[ ], separated by commas. Lists can contain any type of object and this makes them very useful and versatile.
Fundamental characteristics of Python lists are as…
Generators are special functions that return a lazy iterator which we can iterate over to handle one unit of data at a time. As lazy iterators do not store the whole content of data in the memory, they are commonly used to work with data streams and large datasets.
Generators in Python are very similar to normal functions with some characteristic differences listed below;
Python programming language is widely used by developers in data science projects. To complete such projects, understanding data structures plays an important role. Python has several built-in data structures such as lists, sets, tuples, and dictionaries, in order to support the developers with ready to use data structures.
In this article, I will try to explain why and when to use Python dictionaries, meanwhile giving you some hints about the correct usage of the dictionary methods.
Let’s understand the Python dictionaries in detail with step-by-step explanations and examples.
In a nutshell, a dictionary can be defined as a collection of…