Tag: Python

Python – Reading and Writing Files – With YouTube Video

Another YouTube video for Python – this time, about reading and writing to files. It is a bit interesting, if these are your first steps with Python, for me it was a nice reminder of how the “things” used to

Tagged with: , , ,

Python – Lambda Expressions – With YouTube Video

As one of the acknoledged reviewers of the Manning book Python How-To, I have decided to make a YouTube video, based on a part of the book, mentioning Lambda Expressions. The video is here, and the code I have used

Tagged with: , , , ,

Python – Cramer’s Rule for Linear Equations – With YouTube Video

Creamer’s rule for a solution of linear equations states pretty much the following: Using this interesting picture from the German Wikipedia, I have created the following video, explaining a bit the Rule of Mr. Cramer: The video goes through the

Tagged with: , , , , , ,

Azure – Quickstart: Deploy a Pyton Flask web app to Azure App Service – With YouTube Video

Following the step-by-step original tutorial here, I have created a simple Azure video tutorial, explaining how to deploy a python flask web app with local git. The idea to have something on your own PC and then simply using this

Tagged with: , , , , ,

Python – Split worksheet to worksheets, save Excel worksheets to csv

Same article, but for VBA is here – https://www.vitoshacademy.com/vba-split-worksheet-to-worksheets-save-excel-worksheets-to-csv/ This article does 2 things: Splits one worksheet to multiple worksheets Then goes through the worksheets and saves them as *.CSV files So what is the idea? Having this excel file,

Tagged with: , , ,

Python – Filtering values from a Pandas DataFrame

Some time ago, probably yesterday or the day before, I had to filter a pandas dataframe and somehow it did not come intuitively into my mind how to do it. As I did not have an article about it, I

Tagged with: , , ,

Python – Just a bit about datetime and timedelta

Ok, dates in VBA and Excel are somehow complicated, because of some “feature” that Microsoft Excel has introduced, due to compatibility issues. I have already wrote a few articles about these here, and separate one about what day is Friday

Tagged with: , , ,

Python – Init a class with a default list property correctly

Sometimes, (but only sometimes) we think that writing too much code is useless and writing less code in python is more readable and performs faster. While in the general case this is true, this article is simply going to show

Tagged with: , , , ,

Python – Enumerate Lists in a Loop

Plenty of times, when you are looping with a for-each loop in python, you somehow realize that you need a counter. Then you most probably write something ugly like this one:

Why is this ugly? Mainly because the next

Tagged with: , , , ,

Python – Plotting a circle with matplotlib

Plotting a circle with matplotlib library in python is an interesting task. If you google it, you will find quite good answers, but anyway, I am here because I want to summarize my point of view. Pretty much, the idea

Tagged with: , , , , ,

Python – dictionary to CSV

Dictionary to a CSV file is probably a good question, if you are hiring a VBA developer. For a python person it should be a trivial one, as this one should not be even a tough search in Google. Anyway,

Tagged with: , ,

How to get redirect url using Excel VBA or Python

Getting some tiny URL, that redirects you to somewhere else might be dangerous. There are a lot of people, that would never ever click on bit.ly/something or goo.gl/something, just because they do not know where the redirect is going to

Tagged with: , , , , , ,

Python – Find All Substrings Between Two Character Pairs with RegEx

Sometimes you need to do what you need to do – use Regular Expressions for a trivial task. Now, imagine that you have some big text and you need to extract all substrings from the text between two specific words

Tagged with: , , , ,

Python – Parsing PDFs with Tika

Reading from a pdf is actually quite an easy task with Python. If the PDF is of course “readable”, e.g. made from a word processor. The first thing to do is to install Tika and Java:

Having this, the

Tagged with: , , , ,

Python – Ordered Dictionary and Heap Queue

After writing about Default Dictionary in Python some time ago, now it is time to take a look at the ordered dictionary and the heap queue as these are built-in structures, coming out of the box. And they are fancy.

Tagged with: , , , ,

Python – Read and Write to Excel ActiveX Textbox

Reading and writing to an Excel ActiveX textbox with Python can be fun. If you really do not have anything better to do. Anyway, if this is your current task, you are on the correct place to see how it

Tagged with: , , , , ,

Python – Docstring – Help and Comments

Docstrings in Python are actually quite simple – the are 3 times this """ and the code between opening and closing them can be formatted in any possible way. The reason I have decided to dedicate a whole article to

Tagged with: , , , , ,

Python – Logging in Python. Formatting with Black

Logging in Python is beautifully implemented with the logging library – https://docs.python.org/3/howto/logging.html It simply does anything you need and you do not need to write something yourself, like I did some time ago here in my VBA Boilerplate. So, if

Tagged with: , , ,

Python – Multisets – A class to count the elements of a set

Ok, so you probably have heard about set in Python – it is a collection with non-repeatable elements – as if you are a stamp collector and you need to collect only the unique stamps into your album. However, in

Tagged with: , ,

Python – Writing a Logger in Python with a decorator

Functions in Python are objects. If this is the first time you read this sentence, then you will not get a lot from this article, but it will show you, that there is quite a lot to learn about Python.

Tagged with: , ,

Python – DefaultDict Object. Or how to avoid the Key Error.

Have you seen the error below?

Of course you have. And you know, that it is because you have written something extremely unwise like this:

Yeah. You cannot increment the value of a non-existent key. Unless… Unless you

Tagged with: , ,

VBA and Python – Intersection of dictionaries

Intersection of dictionary (or of any two lists) is a list with elements, that are present in both other lists. Thus, if we have the following 3 dictionaries in Python:

Then, an intersection of their keys will contain only

Tagged with: , , , , , ,

Python – Class Variable vs Instance Variables

Class variables vs instance variables could seem a bit strange, if you have no OOP experience, but after a few thausand lines of code they become logical. So, in around two days of programming you will be getting it intuitively

Tagged with: , , ,

Python – Difference between __str__ and __repr__

__repr__  and __str__  dunders are quite similar in Python. If you need  a quick summary of these 2, then these 3 points will be enough: __repr__ dunder presents the class object, whenever it is called by the terminal __str__ dunder

Tagged with: , , ,

Json.dump vs json.dumps in Python

The difference between json.dump and json.dumps is actually quite visible: dump()  – dumps into a file or StringIO dumps()  – dumps a string, that could be printed Still, I am going to give a few example with these, as the

Tagged with: , , , ,

Python – Iterators

One of the benefits of having your own blog and not following any schedule for subjects to write about is that you may write for whatever you feel like, whenever you feel like. So, Iterations in Python is the subject

Tagged with: ,

Django – CRUD application with Python

Making a CRUD application with Python is actually one of the basic thing a Python Developer should be able to do. Although some may argue it is extremely basic – it is not. Requirements The basic requirements for this one,

Tagged with: , , , , , , ,

Python – Exception handling

Exception handling in python is actually quite an interesting topic. In general, the exceptions in programming could be of three types: syntactic errors – these would be noticed by your IDE or by the interpretor, thus you do not need

Tagged with: , , ,

Using API calls with VBA and Python to Read and Write to a Database

Using API calls with VBA and Python to write a database is actually a pretty decent architecture. Here, I would like to say that “It takes the best of the both worlds”, but the truth is that it takes the

Tagged with: , , , , , , , ,

Python – Django Girls – Introduction to Django – Video

Months ago, I was planning to take part in the #RailGirls event in Sofia, and I was even a partner in the event. Anyway, as it was postponed up to somewhere in the future, I have decided to go through

Tagged with: , , ,
Top