Tag: Python

Cryptography in Python

ModernPythonStandardLibraryBook

After writing about hashing passwords in Python, I have decided to publish the other parts of the chapter, “Cryptography” from the “Modern Python Standard Library Cookbook“, written by Alessandro Molina and and kindly provided to me by PacktPublishing.In the article,

Tagged with: , , , , , , , , , ,

Python – Platforms Jumping – CodeForces

Greedy algorithm is described as an algorithm that follows the problem-solving heuristic of making the locally optimal choice at each stage with the intent of finding a global optimum. Thus, it is always interesting to find a problem, which can

Tagged with: , , ,

Python Slice Notation

Python Slice Notation is somehow easy and tough in the same way. Lately, I was doing some competitive programming with Python and I have decided to write a summary of the slice notation, thus there is always a place for

Tagged with: , , , , , , ,

Python – Binary String Minimizing Problem – CodeForces

Codeforces has introduced a third division in their competitions. Initially I though this is the place to go for “easy” stuff, as far as some of the 2nd division problems require some advanced algorithms, like combinations of graphs and months

Tagged with: , , , , ,

Scraping a web site up to the N-th level with Python

Scraping data from a web site has always been a pleasure with Python. If you come from the VBA world, the BeautifulSoup4 is indeed beautiful! I have been scraping a web site with python before, but now as I have

Tagged with: , , , ,

Prime numbers matrix and coloring with Python and xlsxwriter

About 4 years ago, I wrote an article about prime numbers in Excel and their visualisation with VBA – vba-function-in-excel-to-check-prime-numbers. Pretty much, it displays the prime numbers in a 10 x N matrix, starting from 1 and finishing at N:

Tagged with: , , , , , , , , , ,

Scraping web site and writing its links to a database with Python

Scraping a web site with BeautifulSoup 4 and Python is a walk in the park, if you have scraped a web site with VBA before. Still, there are a few tricks, that should be taken into account. Trick #1 –

Tagged with: , , ,

Adding data to SqlLite3 database with Python

After reading the database to python from the previous post here, it is time to do the ADD data to the database. Our database is created like this:

The database has autoincremented primary key, thus we do not need

Tagged with: , , , ,

Connecting SqlLite3 database to Python and Reading it

Connecting SqlLite3 database to a Python file is actually 1 line of code: conn = sqlite3.connect(r"C:\Users\database.db") I have used a database from sqllitetutorial.net, which was rather neat. Then DB Browser for SQLLite a LEFT JOIN was implemented, in order to unite the

Tagged with: , , ,

Adding data to SqlLite3 database, but only one value with Python

Life is hard, when you are learning Python and you see things that are making no sense the way they run. After writing about adding data to SqlLite3 with Python, today I have tried to do the same, but for

Tagged with: , , ,

Find all HTML tags in a web page and print them from a sorted dictionary

Finding all HTML tags from a web page and recording these to a dictionary is magically easy task with Python (if you compare it with #VBA), when Beautiful Soup 4 is used. soup.find_all(True) loops through the tags and a simple

Tagged with: , , , ,

Write Formulas in Excel through Python XlsWriter

Writing formulas with Excel with Python is a technique, that needs some practice, actually. Although XlsWriter has some good documentaion, not a lot is covered on the point, that concerns creating a file with a formula in it. First and

Tagged with: , , , ,

Show all links from a website with Python and BeautifulSoup

Showing all links from a website with Python and BeautifulSoup is actually 6 lines of code – 2 to define the used libraries and 4 to do the job:

In general, BeautifulSoup comes out of the box with beautiful

Tagged with: ,

Python – The birthday paradox algorithm

The birthday paradox is an interesting problem, mainly because of its somehow “unexpected” results. The problem usually is stated as the following: What is the minimum number of people in a room, in order to have a probability higher than

Tagged with: , , ,

Sets in Python – Differece, Symetric Difference, Union, Intersection

After writing the article scraping a web site up to the N-th level with Python, I have decided to summarize what could be achieved with Set() in this language. Pretty much, sets can be described as lists with a few

Tagged with: , , , ,

Numpy and Pandas – Small introduction with Jupyter Notebook

Last week I was participating at the Python and ML Summit in Berlin. One of the most interesting lectures, on which I participated, was a workshop by, named “Reading all yourself was yesterday – How to turn large amounts of

Tagged with: , , , , ,

Python – Stand Alone Application with GUI

Python has a built-in GUI package, which allows easy building of forms like this: The package used in this example is tkinter. The form above takes the value, entered in the entry field, squares it and displays it back in

Tagged with: , , , ,

Analyzing trends with map and reduce in Python

Editorial (from Vitosh): Lately, I have reviewed the Mastering Large Datasets book by J.T. Wolohan. The book is python based and it explains how to scale a data project, using the map and reduce to scale data projects. Long story

Tagged with: , , , ,

Python – Customizing PyLab using Style

Learn how to customize PyLab using style in this article by Benjamin Walter Keller, a PhD candidate at McMaster University with BSc in physics with a minor in computer science from the University of Calgary in 2011. This article will delve

Tagged with: , , , ,

Python – Plotting with Object-Oriented API

Learn how to plot a correlation matrix using pyplot and object-oriented APIs in this article by Srinivasa Rao Poladi, the co-founder of krtrimaIQ a consulting firm that provides cognitive solutions to create tomorrow’s Intelligent Enterprises powered by automation, big data,

Tagged with: ,

Python – Balancing CartPole with Machine Learning

This article will show you how to solve the CartPole balancing problem. The CartPole is an inverted pendulum, where the pole is balanced against gravity. Traditionally, this problem is solved by control theory, using analytical equations. However, in this article, you’lllearn to solve the

Tagged with: ,

Build, Test, and Deploy with Zappa

Learn how to build, test, and deploy a Python web service using Zappa in this article by Abdulwahid Abdulhaque Barguzar, a software architect and an active contributor to the open source community. He has developed a deep understanding of architecting

Tagged with: , , , ,

Using NumPy for Simulations

Learn how to use NumPy for simulations in this tutorial by Alvaro Fuentes, a data scientist with an M.S. in quantitative economics and applied mathematics with more than 10 years of experience in analytical roles. NumPy, also known as Python’s vectorization solution,

Tagged with: , , , ,

Hashing Passwords in Python

ModernPythonStandardLibraryBook

Learn how passwords can be stored without a risk of leaking them in this tutorial by Alessandro Molina, a Python developer since 2001 and currently the core developer of the TurboGears2 web framework and maintainer of Beaker Caching/Session framework.While cryptography is

Tagged with: , , ,

Python – Write Values in all Worksheets of existing Excel File

Working with VBA is usually not considered high level of programming. Still, when it comes to Excel, this is probably the best solution. However, Python has some libraries which can help a bit, if you are willing to “mimic” the

Tagged with: , ,

How to Search In Excel Worksheet with Python

Working with Python and Excel together is really fun for a VBA Developer! It somehow shows you what all these years of coding with VBA have taught you! Today, I was thinking how to implement the .Find() method of searching in

Tagged with: , , ,

Python – Simple writing in Excel with XlsWriter

The XlsxWriter library of Python is a nice gem for a VBA developer – you would be really interested to see the problems a Python developer should be facing, just to achieve a simple part Excel automatization. Still, these are

Tagged with: , ,

DevOps Conference in coming – time to install Python on my machine

In less than 4 days I would be travelling to Berlin to see what is happening on the DevOpsCon there. I will be present for a whole day workshop for machine learning with Python, thus I have decided that it

Tagged with: , ,

Python – Algorithm from CodeForces – Bears and Blocks

Hello party people! 🙂 Today I was wondering whether I have forgotten to code in Python after 4 weeks of coding marathon in VBA and I have decided to try a small portion of the weekly challenge from CodeForces! So, the

Tagged with: , , ,

Python – Algorithm – Calculate Average distance with Dijkstra

In the current article I will try to solve a problem for calculation of average distance with Dijkstra, given in codeforces.com contest here in pdf. What is the problem like? We have n weighted graphs like this: For each given graph,

Tagged with: , ,
Top