pdfeaturegen

Supporting functions to generate features in Pandas Dataframe for Machine Learning


License
MIT
Install
pip install pdfeaturegen==0.0.3

Documentation

Pandas Feature Generator

Supporting functions to generate features in Pandas Dataframe for Machine Learning

Installation

pip install pdfeaturegen

Usage example

import pdfeaturegen as pdfg
df = pd.read_csv('data/human_daily_pattern.csv')
df.head()
"""
|   | time                       | count               |
|---|----------------------------|---------------------|
| 0 | 2018-03-26 12:39:55.481733 | 121.35529262690343  |
| 1 | 2018-03-26 17:17:23.911690 | 0.3647851407453441  |
| 2 | 2018-03-26 09:56:38.268554 | 0.07366381105375536 |
| 3 | 2018-03-26 20:35:51.533865 | 0.28542161371348845 |
| 4 | 2018-03-26 17:22:16.504024 | 13.302750810079269  |
"""

df = pdfg.timestamp_feature_engineering_with_df(df, df.time)
df.head()
"""
|   | time                       | count               | time_year | time_month | time_day | time_hour | time_minute | time_second | time_week | time_weekday_name | time_weekofyear | time_quarter | time_is_leap_year | time_is_month_end | time_is_month_start | time_is_quarter_end | time_is_quarter_start | time_is_year_end | time_is_year_start |
|---|----------------------------|---------------------|-----------|------------|----------|-----------|-------------|-------------|-----------|-------------------|-----------------|--------------|-------------------|-------------------|---------------------|---------------------|-----------------------|------------------|--------------------|
| 0 | 2018-03-26 12:39:55.481733 | 121.35529262690343  | 2018      | 3          | 26       | 12        | 39          | 55          | 13        | Monday            | 13              | 1            | False             | False             | False               | False               | False                 | False            | False              |
| 1 | 2018-03-26 17:17:23.911690 | 0.3647851407453441  | 2018      | 3          | 26       | 17        | 17          | 23          | 13        | Monday            | 13              | 1            | False             | False             | False               | False               | False                 | False            | False              |
| 2 | 2018-03-26 09:56:38.268554 | 0.07366381105375536 | 2018      | 3          | 26       | 9         | 56          | 38          | 13        | Monday            | 13              | 1            | False             | False             | False               | False               | False                 | False            | False              |
| 3 | 2018-03-26 20:35:51.533865 | 0.28542161371348845 | 2018      | 3          | 26       | 20        | 35          | 51          | 13        | Monday            | 13              | 1            | False             | False             | False               | False               | False                 | False            | False              |
| 4 | 2018-03-26 17:22:16.504024 | 13.302750810079269  | 2018      | 3          | 26       | 17        | 22          | 16          | 13        | Monday            | 13              | 1            | False             | False             | False               | False               | False                 | False            | False              |
"""

Release History

  • 0.0.1
    • Work in progress

Meta

Ivan Foong – @vonze21vonze21@gmail.com

Distributed under the MIT license. See LICENSE for more information.

https://github.com/ivanfoong/pdfeaturegen

Contributing

  1. Fork it (https://github.com/yourname/yourproject/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request