Python In Plain English
Go deeper with the language powering everything.
Image for post
Image for post
Data is chaos and perhaps in this chaos you would find the most wonderful patterns — venali sonone

A guide to optimization problems with Google OR-Tools for Python

人間には『善の心』ともう1つの『悪の心』が存在しているんです!
“Every human being has a “good heart” and another “evil heart”!
Optimization of both is required to excel, it is a non-trivial quest.”

Topics Covered

  1. Optimization problem, what is it?
  2. Guide to Linear Optimization — Solver glop and Simplex algorithm
  3. Guide to Linear Optimization — Guide to Linear Optimization -
  4. Guide to Integer Optimization — MIP Solver
  5. Guide to Integer Optimization — Solving a MIP Problem
  6. Guide to Integer Optimization — Using Arrays to Define a Model
  7. Constraint Optimization — CP-SAT Solver
  8. Constraint Optimization — Using a CP-SAT Problem
  9. Constraint Optimization — Solving a CP-SAT Problem
  10. Constraint Optimization — Cryptarithmetic Puzzles
  11. Constraint Optimization — The N-queens…


Image for post
Image for post

Sklearn has got to be one of my favourite libraries in Python. This library is not static, as it frequently introduces new functions in its updated releases. The current version of sklearn is 0.23.2 where it has introduced new features, such as: visual representation of estimators, improvements to K-means, improvements to gradient boosting, new generalised linear models, and sample weight support for existing regressors. It is always a good idea, therefore to find out the new features of this fascinating library and incorporate them into programming in an attempt to improve performance.

One new feature in sklearn’s version 0.20 is ColumnTransformer(). This function applies transformers to columns of an array or pandas DataFrame. It allows different columns or column subsets of the input to be transformed separately and the features generated by each transformer will be concatenated to form a single feature space. …


Fiction the game in which cup with the ball with Python

Image for post
Image for post
Foto von Burst von Pexels

It is useful in many areas for Python users. It maintains its prestige by reaching a wider audience thanks to its understandable and easy-to-read code structure. In this way, Python training has become an important focus today. And certainly there is a lot more to understand it easier now.

Now, coming to the topic of this article, quick tutorials can bring a level. And especially as far as functions are concerned, we know that perhaps most people can have a basic knowledge fast without getting too tired. However, from this point on, the details start to get boring. You will always need practical projects to learn in depth. …


Quickly download datasets directly from Kaggle

Image for post
Image for post
Photo by Chris Liverani on Unsplash

Kaggle is the world’s platform for everything data science. Like a strange social network, full of data scientists, with Jupyter notebooks everywhere.

It’s a great platform to learn and compete thanks to the dazzlingly large number of competitions on the site posted by companies looking for solutions to their data science problems, without spending too much.

This ecosystem unsurprisingly produces a lot of datasets — which is why you’re here. You want to download data from Kaggle with Python, and that is exactly what we will do.

If you prefer video, we cover the Kaggle API setup and use here…


Image for post
Image for post

Linear Search

In linear search, each element of the array/list is compared from the beginning to the end with the element entered to be searched for.

Linear Search is also called as sequential search .

In linear search, it is not compulsory to have the elements sorted. The elements can be in any order.

Image for post
Image for post


Image for post
Image for post

I do not have a lot of experience with CatBoost, but since it is said to be as good as XGBoost and LightGBM I thought I should become familiar with this model. CatBoost is a fast, scalable, high performance gradient boosting on decision trees library. This model is used for ranking, classification, regression and other machine learning task. CatBoost is developed by Yandex researchers and engineers, and is used for search, recommendation systems, personal assistant, self-driving cars, weather prediction and many other tasks. …


Tutorial on Applying Functions to Pandas DataFrames

Image for post
Image for post
Photo by picjumbo_com on Pixabay

Feature Engineering is an important step in the Data Science workflow. It is the process of extracting features from raw data using data mining techniques and domain knowledge. This can involve performing transformations or univariate, binary, and multivariate statistical analysis on existing data. These derived values can make data more intuitive for analysts and their algorithms. An experienced practitioner can quickly assess the problem and brainstorm new features to create based on existing data. These features, ranging in complexity, may require calculations that are easily done (and more readable) using Lambda functions. …


And how not to concatenate strings

Image for post
Image for post
Photo by Lance Grandahl on Unsplash

I always used to concatenate strings using the “+” operator irrespective of the language I code only to realize later that I was doing them wrong. To be precise, inefficient.

Today, we shall discuss string concatenation in python and how to do it efficiently.

x =  "hello"
y = "world"
print(x + y)
Output:
hello world

As we are aware of the fact that string objects are immutable in python, any concatenation operation using the “+” operator could prove to be costly.

Why is it so?

String objects are immutable in python and any concatenation operation creates a new string, copies the old string character by character and then appends the new string to be concatenated. …


Tutorial | Python | Discord.py

Upgrade your bot’s messages and make them a little more custom using embeds!

Image for post
Image for post
Title card by the author

When your Discord bot responds to your server, you don’t always want a boring default message to be sent back. Maybe you have links or images that you want to send back in chat. With Python and Discord.py, this is super easy to do in your Discord bot!

Note: This is tested on version 1.4.1 of the Discord.py module. You will encounter issues if you are using a version lower than 1.0. It is recommended that you migrate your code to a more current version.

Building Embeds

Embeds in Discord are simple and have a very clean, formatted look to them. In this tutorial we will go through how to create an embed and customize every part of it. …


Image for post
Image for post

Linked Lists

GeeksforGeeks describes Linked list as a linear data structure, in which the elements are not stored at contiguous memory locations. These elements are called as nodes. Each node contains a data field and a reference (link) to the next node in the list.

Image for post
Image for post

Few common types of linked lists are as follows —

  1. Singly linked list
  2. Doubly linked list
  3. Circular linked list

According to GeeksforGeeks, Singly linked list is the simplest type of linked list in which every node contains some data and a pointer to the next node of the same data type. The node contains a pointer to the next node means that the node stores the address of the next node in the sequence. A single linked list allows traversal of data only in one way. …

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store