Data Science

Converting Between Python Dictionaries and JSON

We will use json.dums() function to convert to json from python dictionary and json.loads() to convert from json to python dictionary. In this example code we used flower details data in python dictionary and converted it to json. import json # flowers in python dictionary flowers = { “rose”: { “scientific_name”: “Rosa”, “grows_in”: [“gardens”, “wild”], […]

How to create, read and write csv file from python

First Lets talk about csv Its a plain text format which comes from (Comma Separated Values) Most spreadsheet application supports this. You can open and edit it from excl, Libra office cal , google sheets and other spread sheet application, also supported by most of the programming language. For simplicity and flexibility often used in […]

Display Matplotlib Plots in Pygame: A Step-by-Step Guide

Our tasks for this Import necessary module import sys import pygame import matplotlib from pygame.locals import * import matplotlib.pyplot as plt from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas This code imports a tool from Matplotlib that lets you save plots as image files (like PNG or JPG). Use this for […]