• Coding

    Python: Matplotlib – How to use csv and subplots for beginners

    So how do I use subplots? 08/26/2018 The code below is custom to my csv file (see below), so make sure you either use the same format or change the "get_file" function to the properly process your file. MOCK_DATA_2 The file above looks like this: x,y 64,13 57,14 16,30 92,29 65,97 11,33 [sourcecode lang=”python”] from matplotlib.pyplot import * import numpy as np, os from typing import List #get file def get_file(filename: str): #determines validity of path #returns file content filepath = os.path.abspath(filename) if os.path.exists(filepath): fh = open(filepath) header = fh.readline() #excludes first row of the csv file e.g. x,y data = {"x":[],"y":[]} for row in fh.readlines(): if len(row) <= 0:…

  • Coding

    Automate Simple Tasks with Python: Excel Table to HTML Table using the python Dominate Module

    Book Sometimes a database is really not necessary. Why not try a simple excel sheet Coded this in an hour; sips on coffee though 9:06:34 PM I generated the excel workbook using a website called Mockaroo. Today’s task is to convert a basic excel sheet table into an HTML table. I broke the task into sub tasks which were then later translated into functions.   Do you need a website ? I can build it for you! PseudoCode Convert Excel Table into one dimensional List containing dictionaries Convert List into HTML document Save HTML string into a file with “.html” extension Done The Excel Sheet looked like this: MOCK_DATA The code generated…

Enjoy this blog? Please spread the word :)

error: Content is protected !!