GithubHelp home page GithubHelp logo

breoganpardo / ie_pandas Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 36 KB

This project contains the group assignment for Advanced Python, on which we have to create our own Python installable package for own created simplified "Pandas library".

License: MIT License

Python 100.00%

ie_pandas's Introduction

IE Pandas


This is Team C's final project in Advanced Python.

A simple implementation of dataframe functionality

The library is available in Pypi

Installing


The easiest way to install ie_pandas is through pip

pip install ie_pandas

To use it in your project, you must first import the library

from ie_pandas import Dataframe

You can create a frame by the following 4 methods:

  • A list of lists
  • A numpy array of lists
  • A dictionary of lists with keys being column names and values being the values for that column
  • A dictionary of numpy arrays (same as with lists)
dictionary = {'c0': [1, 3, 5], 'c1': [7, 6, 2], 'c2': [2, 4, 7], 'c3': [5, 3, 9]}
df = DataFrame(dictionary)

Functionality

  • Create dataframes from list of lists, numpy arrays, dictionaries of lists and numpy arrays
dictionary = {'c0': [1, 3, 5], 'c1': [7, 6, 2], 'c2': [2, 4, 7], 'c3': [5, 3, 9]}
df = DataFrame(dictionary)

# You may optionally pass along two parameters, cols and index
# cols determines the column names (if blank they will be numerical strings)
# index determines the row names (if blank they will be numbers)
df = DataFrame(dictionary, cols = ["col0", "col1", "col2", "col3"], index = ["row1", "row2", "row3"])
  • Access columns by name
df['column_1']
  • Access rows by position or by row name
df.get_index(1)
# or
df.get_index('row_1')
  • Access data like a numpy array by name
df[0:2, 1:3]
  • Modify dataframe
df[0,0] = 3
  • Sum, median, mean, min, max methods (only work for numerical columns)
df.mean()

Since the underlying object of the dataframe is a numpy array, you may perform aditional functionality like

df[:, 1:2].sum()
  • Visualize relationships between 2 entirely numerical columns (only for numerical columns)
df.visualize(df[:, 2], df[:, 3])
# or
df.visualize(df["c1"], df["c2"])

Dependencies

IE_Pandas only requires the following packages:

  • Numpy (>=1.16)
  • Matplotlib (>=3.0.2)

However, for development purposes, the following packages are needed:

  • Pytest (>= 4.2)
  • Pytest-cov (>= 2.6)
  • Black (for PEP8 compliance)

Development


For development purposes, you may download the files directly and install the library locally by placing your terminal in the downloaded folder and doing

pip install --editable .[dev]

Then, to execute the tests you just need to run

pytest --cov

IE_Pandas Coding Style


IE_Pandas complies to PEP8 and uses black for coding standards

Versioning


SemVer is used for versioning.

License


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

ie_pandas's People

Contributors

akoury avatar andrewrizk avatar breoganpardo avatar paul-jm avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

andrewrizk

ie_pandas's Issues

Add some tests

You are doing a great job with the pull requests and the reviews. However, without looking closely at the code it's clear that there's a lot of functionality, but it's not tested. I recommend you to

  • Test what has already been implemented
  • Do not include further functionality if it's not tested

Otherwise, it's very common to leave the tests for the end, and believe me - you will find unexpected problems!

Avoid using __getitem__ directly

You implemented the __getitem__ method for the DataFrame, however you don't need to use it: you can use the square brackets instead. For example:

>>> class Foo:
...   def __getitem__(self, item):
...     return f"This {item}"
... 
>>> f = Foo()
>>> f.__getitem__("bar")
'This bar'
>>> f["bar"]
'This bar'

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.