Skip to content

TST: Add list of tuples pd.factorize test #18649

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

Merged
merged 1 commit into from
Dec 9, 2017

Conversation

Licht-T
Copy link
Contributor

@Licht-T Licht-T commented Dec 5, 2017

np.array(expected_label))

expected_level_array = np.empty(len(expected_level), dtype=object)
expected_level_array[:] = expected_level
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use pandas.core.common._asarray_tuplesafe to get a numpy array of tuples, i.e. expected_level = _asarray_tuplesafe(expected_level)

@Licht-T Licht-T force-pushed the add-tuple-list-factorize-test branch from e80e8b6 to 25838d1 Compare December 6, 2017 00:12
@Licht-T
Copy link
Contributor Author

Licht-T commented Dec 6, 2017

@jschendel Thanks! Fixed!

@jreback jreback added Testing pandas testing functions or related to the test suite Compat pandas objects compatability with Numpy or Python functions labels Dec 6, 2017
@Licht-T Licht-T force-pushed the add-tuple-list-factorize-test branch from 25838d1 to ed36eda Compare December 6, 2017 23:17
@codecov
Copy link

codecov bot commented Dec 6, 2017

Codecov Report

Merging #18649 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18649      +/-   ##
==========================================
+ Coverage   91.57%   91.58%   +0.01%     
==========================================
  Files         153      153              
  Lines       51210    51234      +24     
==========================================
+ Hits        46894    46922      +28     
+ Misses       4316     4312       -4
Flag Coverage Δ
#multiple 89.44% <ø> (+0.03%) ⬆️
#single 40.66% <ø> (-0.12%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.81% <0%> (-0.1%) ⬇️
pandas/plotting/_timeseries.py 60.73% <0%> (-0.1%) ⬇️
pandas/tseries/offsets.py 96.86% <0%> (-0.09%) ⬇️
pandas/plotting/_compat.py 62% <0%> (ø) ⬆️
pandas/io/parquet.py 65.38% <0%> (ø) ⬆️
pandas/core/indexes/datetimes.py 95.68% <0%> (ø) ⬆️
pandas/core/indexes/base.py 96.45% <0%> (+0.01%) ⬆️
pandas/core/indexes/period.py 92.94% <0%> (+0.04%) ⬆️
pandas/core/window.py 96.37% <0%> (+0.06%) ⬆️
... and 2 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 fdba133...ed36eda. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 6, 2017

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18649      +/-   ##
==========================================
- Coverage    91.6%   91.56%   -0.05%     
==========================================
  Files         153      153              
  Lines       51272    51272              
==========================================
- Hits        46969    46945      -24     
- Misses       4303     4327      +24
Flag Coverage Δ
#multiple 89.42% <ø> (-0.03%) ⬇️
#single 40.68% <ø> (-0.11%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/plotting/_converter.py 64.78% <0%> (-1.74%) ⬇️
pandas/util/testing.py 81.82% <0%> (-0.2%) ⬇️
pandas/core/frame.py 97.81% <0%> (-0.1%) ⬇️
pandas/core/indexes/datetimes.py 95.59% <0%> (-0.1%) ⬇️

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 27a64b2...85063b8. Read the comment docs.

result = pd.factorize(data)

tm.assert_numpy_array_equal(result[0],
np.array(expected_label, dtype=np.int_))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think dtype=np.intp should fix the failure on appveyor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah...! Thanks @jschendel!

@Licht-T Licht-T force-pushed the add-tuple-list-factorize-test branch from ed36eda to 85063b8 Compare December 9, 2017 02:28
@jreback jreback added this to the 0.22.0 milestone Dec 9, 2017
@jreback jreback merged commit 86606b2 into pandas-dev:master Dec 9, 2017
@jreback
Copy link
Contributor

jreback commented Dec 9, 2017

thanks @Licht-T

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

factorize fails for list of tuples
3 participants