Category: Python, Pandas

Solution for permission and connection problems with MongoDB on macOS

Stepwise description of solving permission and connection issues with MongoDB on macOS. Final stabile solution (see §7) is setting a global alias with the right path in ~/.zshrc 2.    Prerequisites Suitable machine and macOS version (10.13 or later) to run MongoDB (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/ ) Being able to run commands in Terminal Installed...

Multivariate data, multiviews and interaction

This article I will cover how to: Understand the application of multivariate data Understand the functions of multiviews Datatypes defined by Ben Shneiderman Apply multiviews for exploratory and explanatory data visualization Multivariate Data Analysis Multivariate data analysis is the simultaneous observation and analysis of more than one outcome variable....

String formatting with variables

The method to use is: str.format(*args, **kwargs) Perform a string formatting operation. The string on which this method is called can contain literal text or replacement fields delimited by braces {}. Each replacement field contains either the numeric index of a positional argument, or the name of a keyword argument. Returns...

Object Oriented Programming: Comparing and inheritance

Overloading equality When comparing two objects of a custom class using ==, Python by default compares just the object references, not the data contained in the objects. To override this behavior, the class can implement the special __eq__() method, which accepts two arguments — the objects to be compared — and returns True or False....

Creating a subclass

The purpose of child classes — or sub-classes, as they are usually called – is to customize and extend functionality of the parent class.  Let’s call the Employee class from what we have done earlier. In most organizations, managers enjoy more privileges and more responsibilities than a regular employee. So it...

Object Oriented Programming in Python

In normal life to tend to think in sequences of activities. Procedural programming Code as a sequence of steps Great for data analysis and scripts Object-oriented programming Code as interactions of objects Great for building framework and tools Maintainable and reusable code! Objects as datastructures Object = state +...

How to create a DataFrame in Pandas from a list and add columns

Imagine we have a list and we want to be able to use it as a Pandas DataFrame in Python, how do we do that? And just for fun, I got my inspiration for these delicious fruits from this website: https://www.whateatly.com/category/fruits/ Never mind, now we created and printed our...

Reading a .csv file with Python and creating a DataFrame

In this chapter I will dive into reading the data in .csv file and creating a DataFrame. A .csv file stands for comma-separated value, so it simply contains a set of values separated by a comma where each line is a new record in plain text. For this exercise...