HOME/Articles/

matplotlib example head (snippet)

Article Outline

Python matplotlib example 'head'

Functions in program:

  • def main():

Modules used in program:

  • import os
  • import matplotlib.pylab as plt
  • import pandas as pd
  • import scipy as sp

python head

Python matplotlib example: head

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import scipy as sp
import pandas as pd 
import matplotlib.pylab as plt
import os

def main():
    os.system('cls')
    print("Todo:\n",pd.read_csv('datos.csv'))
    print("\n-----------------------")
    datos = pd.read_csv('datos.csv')
    print("Head:\n",datos.head())
    print("\n-----------------------")
    print("Info:\n",datos.info())
    print("\n-----------------------")
    print("Describe:\n",datos.describe())
    t = sp.linspace(0,2, 10)
    plt.plot(t, t*2)
    plt.show()


if __name__ == '__main__':
    main()