Sign in

Originally published at http://www.ds4n6.io.

If you want to change the font size, for instance, you can do it through overriding templates ( docs, base templates), but it can get complex. So the easiest way is to convert to LaTeX first, do some simple replacements, and then convert the resulting LaTeX to pdf via the pdflatex utility:

Requirements:

  • texlive-xetex must be installed in the system (Ubuntu installation: apt-get install texlive-xetex texlive-generic-extra)

Refs:


Originally published at http://www.ds4n6.io.

Often times you will be working in different notebooks (with different kernels) and you will want to share a variable from one notebook to the other.

In order to share a variable (e.g. string, dict, Series, DataFrame, etc.) just use the %store magic:

On the “sending” side:

On the “receiving” side:

That’s it!

Read more about the %store magic here:

https://ipython.readthedocs.io/en/stable/config/extensions/storemagic.html


Originally published at http://www.ds4n6.io.

If you come from a UNIX/Linux background, I’m sure one of your favorite commands is grep. It is so easy to use and so powerful!

grep allows you do regular expression searches in text data (typically files).

The good news is that pandas includes a function…


Originally published at http://www.ds4n6.io.

If you need to execute a notebook from the command line (e.g. if you are automating the execution of multiple notebooks or generating a pdf of the output), just run:


Originally published at http://www.ds4n6.io.

Summary

Just follow these 2 steps:

1. Identify your running kernel by running the “%connect_info” magic in Jupyter:

2. …


Originally published at http://www.ds4n6.io.

Refs:


Originally published at http://www.ds4n6.io.

Say you have been working a lot in your current notebook, you have lots of DataFrames and Series that get a long time to be computed, and you want to make sure you recover quickly if, for some reason, your Session (Kernel) dies.

The answer is “dill”.

Installation:

Save a Notebook session:

Restore a Notebook session:

Caveats:

  • Fails when there are generators.
  • If you have pyodbc connection objects hanging around, you’ll need to close them and then set them all to None otherwise, you get a “TypeError: can’t pickle pyodbc.Connection objects” error.
  • The notebook state does not include graphs that were generated by your code, so you’ll need to rerun the cells to bring these back.

Refs:

https://stackoverflow.com/questions/34342155/how-to-pickle-or-store-jupyter-ipython-notebook-session-for-later


Originally published at http://www.ds4n6.io.

You may have been in a situation where you want to have multiple notebooks to run in the same environment, so they share the variables, Series, DataFrames, etc. between them (e.g. …


Originally published at http://www.ds4n6.io.

IPython is a powerful tool to run python code, with special features to make more easy work in Data Science Forensics. In this video we see how to start to use it.

We can use some tools to run python code for DS4n6 (Data Science Forensics)…


Originally published at http://www.ds4n6.io.

Hi DS-Forensicators!

I know I owe you A LOT of introductory content about DS4N6 and the ds4n6.py library (I promised I would create blog entries explaining more in-depth each of the functions and techniques that I presented at the SANS DFIR Summit in July, and they…

DS4N6

Community focused on bringing Data Science & Artificial Intelligence to the fingertips of the average Forensicator and promoting advances in the field.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store