Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upENH: Add pandas_compat.table_from_frame(df) #2836
Conversation
kernc
force-pushed the
kernc:pandas_compat
branch
from
d653e95
to
f1105e1
Dec 19, 2017
This comment has been minimized.
This comment has been minimized.
|
AFAIAC pandas can be installed on travis (and appveyor) to run the tests while not being added to the install_requires listed in setup.py. I assume this is how pandas tests HDFS support as there are tests in their repository and tables listed in optional-requirements, while it does not get installed when you run |
This comment has been minimized.
This comment has been minimized.
codecov-io
commented
Dec 19, 2017
•
Codecov Report
@@ Coverage Diff @@
## master #2836 +/- ##
==========================================
+ Coverage 81.96% 81.98% +0.01%
==========================================
Files 321 323 +2
Lines 54841 54915 +74
==========================================
+ Hits 44952 45023 +71
- Misses 9889 9892 +3 |
kernc
force-pushed the
kernc:pandas_compat
branch
from
4a59487
to
48828e4
Dec 19, 2017
jerneju
approved these changes
Dec 19, 2017
astaric
reviewed
Dec 19, 2017
| class TestPandasCompat(unittest.TestCase): | ||
| def test_table_from_frame(self): | ||
| from Orange.data.pandas_compat import Test | ||
| Test().test_table_from_frame() |
This comment has been minimized.
This comment has been minimized.
kernc
force-pushed the
kernc:pandas_compat
branch
2 times, most recently
from
48a889c
to
5b57c80
Dec 19, 2017
astaric
approved these changes
Dec 19, 2017
| def _is_discrete(s): | ||
| return (is_categorical_dtype(s) or | ||
| is_object_dtype(s) and (force_nominal or | ||
| s.nunique() < s.size**.666)) |
This comment has been minimized.
This comment has been minimized.
astaric
Dec 19, 2017
Member
I guess you do not want to use is_discrete_values here as it is too complicated, but you could at least use the same constant :)
This comment has been minimized.
This comment has been minimized.
kernc
Dec 20, 2017
•
Author
Member
It's the exact same [universal] constant, just computed with more precision.
| metas.append(StringVariable(name)) | ||
| M.append(s.values.astype(object)) | ||
|
|
||
| MAX_LENGTH = max(len(X[0]) if X else 0, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kernc
Dec 20, 2017
Author
Member
Constructing Table objects, one sometimes gets so invested with details that they tend to lose grasp of the whole picture.
Thanks.
This comment has been minimized.
This comment has been minimized.
|
The code look ok to me. Squash if you intended to and I'll merge. Since you ticked the documentation checkbox, should this be mentioned in the docs somewhere? I do not have a specific place in mind so the aswer to this could be "no", or "not yet", but I think it is a useful helper more people should know about :) |
kernc
force-pushed the
kernc:pandas_compat
branch
3 times, most recently
from
d0a4c8e
to
379dd56
Dec 20, 2017
kernc
force-pushed the
kernc:pandas_compat
branch
from
379dd56
to
e602be2
Dec 20, 2017
This comment has been minimized.
This comment has been minimized.
|
Was referring to reasonable docstring as provided. Guessing reviewers should be the ones to catch it until DataFrames become a more frequently integrated pattern. |
kernc commentedDec 19, 2017
•
edited
Issue
Various third parties work with pandas.DataFrames. Missing was a convenient method of transforming result DataFrame into Orange Table.
Description of changes
Add
table_from_frameutility function. No hard pandas dependencies. Please advise on the best way to run the tests.Includes