Merging dataframes with Pandas

Performing Anti-Joins Merge employees and top_cust with a left join, setting indicatorargument to True. Save the result to empl_cust. Select the srid column of empl_cust and the rows where _merge is 'left_only'. Save the result to srid_list. Subset the employees table and select those rows where the srid is in the variable srid_list and print the results. Success! You performed an anti-join by first merging the tables with a left...

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...

Datavisualisation: what can you see?

In this blogpost I am zooming in into understanding how visual informatie is processed by Describing the underlying principles of perceptual organization Explain why design should support visual queries Describe the main guidelines for information visualization Effective visualisations Kosara 2002 “Visualization is so effective and useful because it utilizes...

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 representation of objects

Implementation of str: Implementation of repr Surround string arguments with quotation marks in the __repr__() output. String representation of objects There are two special methods in Python that return a string representation of an object. __str__() is called when you use print() or str() on an object, and __repr__() is called when you use repr() on an object, print...

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...