Today’s tutorial will give you some insights into how you can work with Excel and Python. It will provide you with an overview of packages that you can use to load and write these spreadsheets to files with the help of Python. You’ll learn how to work with packages such as pandas, openpyxl, xlrd, xlutils and pyexcel.
In this tutorial, you will learn about different ways of calculating averages and measuring the spread of a given set of data. Unless stated otherwise, all the functions in this module support int, float, decimal and fraction based data sets as input.
If you have an application with an interface, then screenshots are a great way to show users important components and concepts. However, ensuring that they are current, and thus useful, is a time-consuming task. Wouldn’t it be great if you could automate this task? Good news! I’m going to show you how.
Nearly all of the functions in this module depend on the basic random() function, which will generate a random float greater than or equal to zero and less than one. Python uses the Mersenne Twister to generate the floats. It produces 53-bit precision floats with a period of 2**19937-1. It is actually the most widely used general-purpose pseudo-random number generator.
Python is one of the most popular programming languages due to its simple syntax, ease of learning and cross-platform support. Besides, many high quality Python libraries and modules are available at your disposal, allowing you to do heavy lifting with only a few lines of code. This makes Python one of the most productive ways to develop prototypes. However, Python is not as fast as C programming language, and many performance-critical production software such as the Linux operating system, web servers and databases are written in C. If you are developing a program in C, but some part of it needs to be written in Python, you can actually write a Python module for that and embed the Python module in a C program using Python/C API.
In this tutorial I will give a basic introduction to pandas. Oh, I don't mean the animal panda, but a Python library! Thus, pandas is a data analysis library that has the data structures we need to cleanse raw data into a form which is suitable for analysis (i.e. tables). It is important to note here that since pandas performs important tasks such as aligning data for comparison and merging of data sets, handling of missing data, etc., it has become a de facto library for high-level data processing in Python (i.e. statistics).
When we fully execute each statement of a program, moving from the top to the bottom with each line executed in order, we are not asking the program to evaluate specific conditions. By using conditional statements, programs can determine whether certain conditions are being met and then be told what to do next. Let’s look at some examples where we would use conditional statements:
As a learning exercise, I recently to dug into Python 3 to see how I could fire off a bunch of emails. There may be more straightforward methods of doing this in a production environment, but the following worked well for me. So, here’s a scenario: You have the names and email addresses of a bunch of contacts. And you want to send a message to each one of those contacts, while adding a “Dear [name]” at the top of the message.
In the first part of this three-part tutorial series, we saw how to write RESTful APIs all by ourselves using Flask as the web framework. In the second part, we created a RESTful API using Flask-Restless which depends on SQLAlchemy as the ORM. In this part, we will use another Flask extension, Flask-Restful, which abstracts your ORM and does not make any assumptions about it.
Python’s str.format() method of the string class allows you to do variable substitutions and value formatting. This lets you concatenate elements together within a string through positional formatting. This tutorial will guide you through some of the common uses of formatters in Python, which can help make your code and program more readable and user friendly.
Variables are an important programming concept to master. They are essentially symbols that stand in for a value you’re using in a program. This tutorial will cover some variable basics and how to best use them within the Python 3 programs you create.
In this part, we will use a Flask extension, Flask-Restless, which simply generates RESTful APIs for database models defined with SQLAlchemy. I will take the same sample application as in the last part of this series to maintain context and continuity.
OpenCV officially provides both C++ and Python APIs for developers. Most of the time, developers just need to use one kind of programming languages to read, write and process images with hundreds of computer vision algorithms. However, if you want to use OpenCV Python APIs with an extended C/C++ library, it will be tricky to pass the data. In this article, I will share how to read camera stream with OpenCV-Python and detect barcode with Dynamsoft C/C++ Barcode SDK.
This tutorial will briefly describe some of the format types Python is able to handle. After a brief introduction to file formats, we'll go through how to open, read, and write a text file in Python 3. When you're finished with this tutorial, you'll be able to handle any text file in Python.
In this three-part tutorial series, I will cover different ways in which RESTful APIs can be created using Flask as a web framework. In the first part, I will cover how to create class-based REST APIs which are more like DIY (Do it yourself), i.e. implementing them all by yourself without using any third-party extensions. In the latter parts of this series, I will cover how to leverage various Flask extensions to build more effective REST APIs in an easier way.
Thus, Zipf's law is trying to tell us that a small number of items usually account for the bulk of activities we observe. For instance, a small number of diseases (cancer, cardiovascular diseases) account for the bulk of deaths. This also applies to words that account for the bulk of all word occurrences in literature, and many other examples in our lives.
I need to preface all of this with a disclaimer: I love Python, but I am able to see plenty of faults with it. In this article, I attempt to provide a very roundabout way of working around one of those faults: the lack of multi-line lambdas. This is not to say that this is a good solution, but it may be one of the best that we have for certain cases. Try and see if one of the typical workarounds is the best option before settling on this.
In this tutorial, you’ll learn about the fundamentals of the scraping and spidering process as you explore a playful data set. We'll use BrickSet, a community-run site that contains information about LEGO sets. By the end of this tutorial, you’ll have a fully functional Python web scraper that walks through a series of pages on Brickset and extracts data about LEGO sets from each page, displaying the data to your screen.
There are a lot of tools out there that do great, advanced things but present them as well as they could be presented. I wont knock cURL for anything -- it's an amazing tool many of us can't live without; what I will say, however, is that it's nice having tools on top of cURL for better presentation or extended functionality.
Python has several built-in methods associated with the string data type. These methods let us easily modify and manipulate strings. We can think of methods as being actions that we perform on elements of our code. Built-in methods are those that are defined in the Python programming language and are readily available for us to use.