Skip to content
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

feat: make Column and Row iterable #55

Merged

Conversation

lars-reimann
Copy link
Member

@lars-reimann lars-reimann commented Mar 21, 2023

Closes #47.

Summary of Changes

  • Add __iter__ method to Column and Row to iterate over the values:
    • Iterating over a Column returns the values.
    • Iterating over a Row returns the column names, as specified in the documenetation of __iter__.
  • Add __len__ method to Column and Row to compute their length.
  • Change superclasses of exceptions as needed for __getitem__:
    • Change superclass of IndexOutOfBoundsError to IndexError.
    • Change superclass of UnknownColumnNameError to KeyError.

@lars-reimann lars-reimann linked an issue Mar 21, 2023 that may be closed by this pull request
@lars-reimann
Copy link
Member Author

lars-reimann commented Mar 21, 2023

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON black 14 0 0 0.68s
✅ PYTHON flake8 14 0 0.41s
✅ PYTHON isort 14 0 0 0.27s
✅ PYTHON mypy 14 0 1.8s
✅ PYTHON pylint 14 0 2.15s
✅ REPOSITORY git_diff yes no 0.03s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@codecov
Copy link

codecov bot commented Mar 21, 2023

Codecov Report

Merging #55 (1922f60) into main (c3fd3b5) will increase coverage by 0.07%.
The diff coverage is 71.87%.

❗ Current head 1922f60 differs from pull request most recent head 8ed98b2. Consider uploading reports for the commit 8ed98b2 to get more accurate results

@@            Coverage Diff             @@
##             main      #55      +/-   ##
==========================================
+ Coverage   91.51%   91.59%   +0.07%     
==========================================
  Files          45       45              
  Lines        1132     1142      +10     
==========================================
+ Hits         1036     1046      +10     
  Misses         96       96              
Impacted Files Coverage Δ
src/safeds/data/tabular/_column.py 89.84% <62.50%> (+0.32%) ⬆️
src/safeds/data/tabular/_row.py 72.00% <100.00%> (+3.81%) ⬆️
src/safeds/exceptions/_data_exceptions.py 96.29% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@lars-reimann lars-reimann force-pushed the 47-iterating-over-column-raises-indexoutofboundserror branch from 65e5cd1 to 1922f60 Compare March 21, 2023 21:27
@lars-reimann lars-reimann merged commit 74eea1f into main Mar 21, 2023
@lars-reimann lars-reimann deleted the 47-iterating-over-column-raises-indexoutofboundserror branch March 21, 2023 21:32
lars-reimann pushed a commit that referenced this pull request Mar 24, 2023
## [0.3.0](v0.2.0...v0.3.0) (2023-03-24)

### Features

* make `Column` and `Row` iterable ([#55](#55)) ([74eea1f](74eea1f)), closes [#47](#47)

### Bug Fixes

* "UserWarning: X has feature names" when predicting ([#53](#53)) ([74b0753](74b0753)), closes [#51](#51)
@lars-reimann
Copy link
Member Author

🎉 This PR is included in version 0.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lars-reimann lars-reimann added the released Included in a release label Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Included in a release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Iterating over column raises IndexOutOfBoundsError
1 participant