Read & write JSON in Python

Generate data to use to read & write JSON Example of random data to use in the following sections data = [] for x in range(5): data.append((random.randint(0,9), random.randint(0,9))) df = spark.createDataFrame(data, (“label”, “data”))...

Dates in Python

Create date from a String import pandas as pd startdate = “10/10/2018” my_date = pd.to_datetime(startdate) print(my_date.strftime(“%Y-%m-%d”)) 2018-10-10 Create current date import datetime my_date = datetime.datetime.now()...

Virtual Environment in Python

Define virtual Environment from command line > python -m venv develop_virtual_enviroment Activate in Environment > ..\develop_virtual_enviroment\Scripts\activate.bat (for Windows) > ..\develop_virtual_enviroment\bin\activate.bat (for Linux)   Disable the...