GithubHelp home page GithubHelp logo

ashrafalaghbari / odc Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 999 KB

A Python Module for Outliers Detection, Visualization and Treatment in Oil Well Datasets

License: MIT License

Jupyter Notebook 97.74% Python 2.26%
anamoly-detection oil-analysis oil-wells oilandgas outliers-treatment petroleum-dataset python

odc's Introduction

Outlier Detection and Treatment with ODC

OilDataCleaner (ODC) is a Python module designed for detecting anomalies in time series data related to the oil industry. With its data cleaning techniques, ODC is an essential tool for anyone working with oil data. Whether you're a researcher, analyst, or engineer, ODC can help you identify unusual patterns and outliers in your data, enabling you to make more informed decisions.

Installation

To use this module:

  1. Clone or download this repository to your local machine.

  2. Install the required packages by running the following command in your command prompt or terminal:

pip install -r requirements.txt

This will install all the necessary dependencies for using this module.

  1. Import the necessary packages and the DetectOutliers class in your Python script:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from odc import DetectOutliers
  1. Load your dataset using pandas and create an instance of the DetectOutliers class:
df = pd.read_csv("F_14.csv", parse_dates=["DATEPRD"], index_col="DATEPRD")
clean = DetectOutliers(df)
  1. Detect outliers in the desired variable:
# Detecting outliers in the 'ON_STREAM_HRS' variable
ON_STREAM_HRS_outliers = clean.detect_outliers_in_time('ON_STREAM_HRS', 'BORE_OIL_VOL')
print("Outliers detected in ON_STREAM_HRS variable:\n", ON_STREAM_HRS_outliers)

Output:

Outliers detected in ON_STREAM_HRS variable:
 DATEPRD
2010-10-31    25.00000
2012-09-15     0.95833
2013-10-27    24.30833
2014-10-26    25.00000
Name: ON_STREAM_HRS, dtype: float64
  1. Plot the outliers:
clean.plot_outliers(ON_STREAM_HRS_outliers)

Output:

test_4_0

  1. Treat the outliers:
df['ON_STREAM_HRS'] = clean.treat_outliers_in_time()
  1. Check that the outliers were treated:
outliers_after_treatment = clean.detect_outliers_in_time('ON_STREAM_HRS', 'BORE_OIL_VOL')
print("Outliers detected in ON_STREAM_HRS variable after treatment:\n", outliers_after_treatment)

Output:

Outliers detected in ON_STREAM_HRS variable after treatment:
 No outliers detected.

For more examples of using this module, please refer to the data_cleaning.ipynb notebook in this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Contact

If you have any questions or encounter any issues running odc module, please feel free to open an issue. I'll be happy to help!

odc's People

Contributors

ashrafalaghbari avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

malrashid22

odc's Issues

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.