Giter VIP home page Giter VIP logo

beat-challenge's Introduction

Fares Estimations

Fares estimations is a Python program for calculating fares based on valid segments. It takes a csv file as database and it sets four columns:

  • id_ride
  • latitude
  • longitude
  • timestamp

Two consecutive tuples are used to calculate a segment's speed, if the speed is > 100km/h then that segment is invalid. This program removes those invalid tuples and calulates the fare based on the speed, distance and time of the day. There is a Test Class provided.

Data

The input data to test this program is the file: 'paths.csv'. I have also created some other csv files one that is empty ('empty.csv'). This because the main function receives a path as a parameter, otherwise just with an empty dataframe should've been enough. The file 'results.csv' corresponds to a csv file with the results of the execution of my code. The file 'random_empty.csv' is a copy of 'paths.csv' but it has some random empty cells (for the test).

Dev

I use python as the main tool for development. Basically I used Jupyter Notebook, and runned it there. In order to run the test class, I had to type at the end of it:

if __name__ == "__main__": 
    unittest.main(argv=['first-arg-is-ignored'], exit=False)

Usage

The main function is fare_estimation(filepath) and it receives the path of the csv file to read as a parameter. An example to run this project is:

estimations = fare_estimation('paths.csv')

An expected output is a DataFrame and a csv file with 2 columns: id_ride, estimated_fare

id_ride fare_estimate 1 11.34 2 13.10 3 32.31 4 2.65 5 22.78 6 9.41 7 29.85 8 9.21 9 6.35

beat-challenge's People

Contributors

larissaojeda avatar

Watchers

 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.