New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 compatibility #16

Merged
merged 15 commits into from Dec 20, 2017

Conversation

Projects
None yet
4 participants
@joshblum
Contributor

joshblum commented Oct 17, 2017

No description provided.

@joshblum joshblum requested a review from kmax12 Oct 17, 2017

MANIFEST.in Outdated
@@ -0,0 +1,4 @@
include requirements.txt

This comment has been minimized.

@joshblum

joshblum Oct 17, 2017

Contributor

Required for tox to see the requirement files referenced in setup.py

@@ -53,8 +53,8 @@ def initialize_logging(config):
err_handler.setFormatter(logging.Formatter(fmt))
err_levels = ['WARNING', 'ERROR', 'CRITICAL']
for name, level in loggers.items():
LEVEL = logging._levelNames[level.upper()]

This comment has been minimized.

@joshblum

joshblum Oct 17, 2017

Contributor

this private variable changed in python3, getattr should have the same functionality and work across python 2.x and 3.x

from collections import Mapping, Set, deque
from numbers import Number
from past.builtins import basestring
from pympler.asizeof import asizeof as getsize

This comment has been minimized.

@joshblum

joshblum Oct 17, 2017

Contributor

The getsize method errors on calculating the size on a pandas SingleBlockManager object. The reference in the docstring also suggested the pympler library so I used that instead

@joshblum joshblum force-pushed the joshblum:py2to3 branch 5 times, most recently from 2d327e5 to a049be0 Oct 17, 2017

@@ -27,7 +33,7 @@ def load_mock_customer(n_customers=5, n_products=5, n_sessions=35, n_transaction
transactions_df = transactions_df.sort_values("session_id").reset_index(drop=True)
transactions_df["transaction_time"] = pd.date_range('1/1/2014', periods=n_transactions, freq='65s') # todo make these less regular
transactions_df["product_id"] = pd.Categorical(choice(products_df["product_id"], n_transactions))
transactions_df["amount"] = random.randint(500, 15000, n_transactions) / 100.0
transactions_df["amount"] = old_div(random.randint(500, 15000, n_transactions), 100.0)

This comment has been minimized.

@kmax12

kmax12 Oct 18, 2017

Member

was the swapping in of old_div automatic? In many of these cases, I think we actually can just use the true divide with python 3 and from __future__ import division to support python 2

This comment has been minimized.

@joshblum

joshblum Oct 18, 2017

Contributor

Sounds good, this was automatically applied during the conversion. Just mark anything that doesn't need it and i'll switch it over :)

@joshblum joshblum force-pushed the joshblum:py2to3 branch from 755c9d3 to 0ea73b5 Oct 19, 2017

@codecov-io

This comment has been minimized.

codecov-io commented Oct 19, 2017

Codecov Report

Merging #16 into master will decrease coverage by 0.99%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           master      #16    +/-   ##
========================================
- Coverage   88.12%   87.12%    -1%     
========================================
  Files          71       74     +3     
  Lines        6829     6937   +108     
========================================
+ Hits         6018     6044    +26     
- Misses        811      893    +82
Impacted Files Coverage Δ
featuretools/demo/__init__.py
...ests/feature_function_tests/test_primitive_base.py
.../feature_function_tests/test_transform_features.py
featuretools/entityset/serialization.py
featuretools/selection/selection.py
featuretools/core/api.py
featuretools/primitives/direct_feature.py
featuretools/core/__init__.py
featuretools/selection/api.py
featuretools/variable_types/__init__.py
... and 95 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update de45be2...58bf3bf. Read the comment docs.

@@ -120,7 +125,7 @@ def get_name(self):
unit = self.readable_unit
if self.readable_unit == "Weeks":
# divide to convert back
return "{} {}".format(self.value / self._convert_to_days["w"], unit)
return "{} {}".format(self.value // self._convert_to_days["w"], unit)

This comment has been minimized.

@joshblum

joshblum Oct 19, 2017

Contributor

note // do we want to cast to int?

This comment has been minimized.

@kmax12

kmax12 Oct 19, 2017

Member

this can be /

This comment has been minimized.

@joshblum

joshblum Oct 19, 2017

Contributor

done

@@ -41,7 +43,7 @@ def get_categorical_nunique_ratio(df, drop_nonumeric=True):
nunique = df.nunique(axis=0, dropna=True)
total = df[nonnumeric_columns].count(axis=0)
return nunique / total
return nunique // total

This comment has been minimized.

@joshblum

joshblum Oct 19, 2017

Contributor

note // do we want to cast to int?

This comment has been minimized.

@kmax12

kmax12 Oct 19, 2017

Member

this can be /

This comment has been minimized.

@joshblum

joshblum Oct 19, 2017

Contributor

done

@@ -133,7 +135,7 @@ def select_percent_null(feature_matrix, features, max_null_percent=1.0, keep=Non
keep = keep or []
null_counts = feature_matrix.isnull().sum()
null_percents = null_counts / feature_matrix.shape[0]
null_percents = null_counts // feature_matrix.shape[0]

This comment has been minimized.

@joshblum

joshblum Oct 19, 2017

Contributor

note // do we want to cast to int?

This comment has been minimized.

@kmax12

kmax12 Oct 19, 2017

Member

this can be /

This comment has been minimized.

@joshblum

joshblum Oct 19, 2017

Contributor

done

@joshblum joshblum force-pushed the joshblum:py2to3 branch 4 times, most recently from 83230da to 60183cc Oct 27, 2017

@kmax12 kmax12 referenced this pull request Nov 18, 2017

Closed

Python 3 support? #32

@joshblum joshblum force-pushed the joshblum:py2to3 branch from 60183cc to 876eafe Nov 27, 2017

@soedr

This comment has been minimized.

soedr commented Nov 28, 2017

Thanks for working towards making this available to python 3 users! Is there a high-level estimate of when it is expected to be released?

@kmax12

This comment has been minimized.

Member

kmax12 commented Nov 28, 2017

@soedr working on it for the next release. if you sign up for the mailing list here, we will email when it's released.

@joshblum joshblum force-pushed the joshblum:py2to3 branch 4 times, most recently from 90058d9 to b662e7f Dec 14, 2017

@joshblum joshblum force-pushed the joshblum:py2to3 branch from b662e7f to 58bf3bf Dec 18, 2017

@kmax12 kmax12 merged commit 99a80d7 into Featuretools:master Dec 20, 2017

2 checks passed

ci/circleci Your tests passed on CircleCI!
Details
license/cla Contributor License Agreement is signed.
Details

@kmax12 kmax12 referenced this pull request Dec 20, 2017

Merged

v0.1.16 - Python 3 Support #48

@joshblum joshblum deleted the joshblum:py2to3 branch Dec 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment