Making tables with Markdown

In Data Science projects, sharing a notebook or making a quick presentation using simple tables can become necessary. This gets handy at the start of project meetings or later. Even though structured and unstructured data can be viewed nicely in tabular forms with libraries such as Pandas, creating a quick table with markdown (or HTML) is an easy task.We only need:Notebook: Jupyter NotebookKernel: Python 3The text to create a table in a markdown cell is shown below. Copy the code into a Markdown cell (last cell) and run to see the table.Just for explanation purposes, '%%capture' takes the stdout/stderr of…

Continue ReadingMaking tables with Markdown

Reading JSON files in Python

JSON (JavaScript Object Notation) is a text format for storing and transporting data. It is "self-describing" and easy to understand. JASON files can be loaded in Python. Two methods are used here: first loading the data using pandas DataFrame and then using the python 'open() file' function. # Reuirements: import pandas as pd from pandas import Series, DataFrame import json # METHOD 1. Read data from fileand display in dataframe: df_components = pd.read_json('Geophysics/components.json') # print(df.to_string()) # print(df) df_components.head() # Set the wellboreName name as index if that's the feature focus# df_components.set_index('wellboreName', inplace=True) # View the first five elements and see how the dataframe…

Continue ReadingReading JSON files in Python