Skip to content

Instantly share code, notes, and snippets.

Avatar

Filippo Bovo FilippoBovo

View GitHub Profile
View git_commands.sh
# GENERAL
git init # Initialise Git repository
git status
git add <file> # Add file to staging index
git add . # Add all files in current directory to staging index
git commit -m <message> # Commit changes
git commit -am <message> # = git add . + git commit -m 'message here'
git fetch --prune # Synchronise the remote branches from the online repository
# LOGS
@FilippoBovo
FilippoBovo / python_and_general_programming_resources.md
Last active Jul 26, 2018
Great Python and General Programming Resources
@FilippoBovo
FilippoBovo / python_decorator.md
Last active Jul 29, 2018
Decorator Example in Data Science
View python_decorator.md

Decorator Example in Data Science

This example explains Python decorators in the context of data science. The example acts as a quick reminder, rather than a complete guide.

Consider a Pandas DataFrame about posts on a social media. The DataFrame, called posts, contains a column with the number of likes for each post.

post_id ... likes ...
1 ... 43 ...
2 ... 92 ...
@FilippoBovo
FilippoBovo / functional_programming_in_python_resources.md
Last active Apr 9, 2019
Functional Programming in Python - Resources
View functional_programming_in_python_resources.md

These are some resources, sorted pedagogically, to get started with functional programming in Python:

  1. Functional Programming in Python by Dan Bader (videos): Nice low level introduction to map, filter and reduce functions. It shows also how easy it is to parallelise code in functional programming.
  2. Learning Data Science using Functional Python by Joel Grus (video): Nice talk on how to translate imperative code into functional code using Python. The title is misleading as data science is not the focus of the talk.
  3. Functional Programming in Python by David Mertz (short book): Nice and short book that explains the basic concepts of functional programming in Python using examples.
  4. Functional Programming HOWTO by A. M. Kuchling (tutorial): Overview of Fu
@FilippoBovo
FilippoBovo / sed_tutorial_by_example.sh
Last active Nov 15, 2018
Sed tutorial by example
View sed_tutorial_by_example.sh
# Sed tutorial by example
# Example: Substitute "cat" with "dog" in file.txt
sed 's/cat/dog/g' file.txt
# Here "s" stands for "substitute" and "g" for global. If "g" was not present, only the first occurrence would be substituted.
# The pattern after the first slash, /, is the pattern to look for and the pattern after the second slash is the pattern to substitute.
# Example: Substitute parentheses, (), in string 'Hello, (awesome) World!' with underscores, _.
echo 'Hello, (awesome) World!' | sed -E 's/(.*)\((.*)\)(.*)/\1_\2_\3/'
# Out: Hello, _awesome_ World!
@FilippoBovo
FilippoBovo / command_line_for_data_science.md
Last active Apr 9, 2019
Command Line uses for Data Science
View command_line_for_data_science.md

Command Line uses for Data Science

The command line for data science is useful for:

  • Quickly check large CSV files
  • Checking data on a server, like in Google Cloud
  • Merging CSV files quickly
  • Replacing tabs with commas or similar formatting

Display CSV file in terminal

@FilippoBovo
FilippoBovo / communication_resources.md
Last active Nov 29, 2018
Communication Resources
View communication_resources.md

Recommended references for Visualisation:

Recommended references for Design: