Giter VIP home page Giter VIP logo

population-data-analysis-using-python's Introduction

Population Python_CSV-Matplotlib

Extracción de datos de un CSV, filtros de datos, transformación y generación de gráficos con Matplotlib, el programa se subdivide en diferentes módulos para segmentar el código.

Ambiente del programa en enviroment.yml

##CSV: World Population Dataset

Contenido:

[TOCM]

[TOC]

main.py

Módulo principal que secciona el programa de acuerdo a las peticiones del usuario, e importa el modulo de buscador que hará la petición.

option=int(input("""
	Write a number search by:

    [1] Population of a country by year
    [2] Rank,capital,country etc.
        
    Choose an option:   """))
    

	if option==1:
		buscador.population()
	elif option==2:
		buscador.browser()

buscador.py

Modulo encargado de llamar a los filtros necesarios de acuerdo a la peticion del usuario.

charts.py

Módulo para la generación de gráficos.

def generate_bar_chart(labels,values,country):
    fig, ax = plt.subplots()
    ax.plot(labels, values)
    ax.set_xlabel('Years')
    ax.set_ylabel('Population')
    ax.set_title('Population of '+country)

    plt.show()

csv_reader.py

Lectura del origen de datos, CSV del World Population Dataset

def csv_reader():
    with open('./population.csv', 'r') as csvfile:
        reader = csv.reader(csvfile, delimiter=',')
        header = next(reader)
        data=[]       
        for row in reader:
            iterable =zip(header,row)
            country_dict = {key:value for key, value in iterable}
            data.append(country_dict)
        return data

filter.py

Módulo de las distintas funciones de filtros del CSV para las peticiones del usuario.

def population_country():
    print(' ')
    selection=input("""    Introduce a country: """)
    search=filter_for_population(selection,parameter='Country/Territory')
    print(search[0])
    country_dict=search[0]
    labels,values=charts.get_population(country_dict)
    charts.generate_bar_chart(labels,values,selection)

##Acerca del proyecto... ...

population-data-analysis-using-python's People

Contributors

pablomxh avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.