Giter VIP home page Giter VIP logo

parser's Introduction

=============================================================
SLOW PARSER - data file full of energy utility meter readings
=============================================================

How to run it.
install ruby
type irb in the terminal
then load 'parse_energy.rb'

you can then play around with the following commands 

r = Reporting.new "./pulse_data.txt", 15
 
r.show_all_data
r.show_unique_customers
r.show_customers_with_gas    
r.show_customers_with_electricity
r.show_all_data :with_table
r.show_unique_customers :with_table
r.show_customers_with_gas  :with_table
r.show_customers_with_electricity :with_table
r.show_avg_consumption_per_bill_month 
r.show_avg_consumption_per_bill_month :electricity
r.show_avg_consumption_per_bill_month :gas
r.show_nbr_of_meters_readings_per_number_of_customers
r.show_nbr_of_meters_readings_per_number_of_customers :electricity
r.show_nbr_of_meters_readings_per_number_of_customers :gas
puts "\nMethods available: #{Reporting.instance_methods(false)}"

=============================================================
FAST PARSER - data file full of energy utility meter readings
=============================================================

You can now run it from the cmd line
  
ruby fast_parser.rb (a prompt will ask for the filename)

or ruby fast_parser.rb filename 

You can also chmod +x fast_parser and execute it directly

fast-parser as at least 20 x improvement on speed. It handles the 100K line file I have in 10 seconds

parser's People

Contributors

6ewis 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.