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: add schema conversions when adding new rows to a table and schema conversion when creating a new table #432

Merged
merged 66 commits into from
Jul 12, 2023

Conversation

alex-senger
Copy link
Contributor

@alex-senger alex-senger commented Jul 7, 2023

Closes #404
Closes #322
Closes #127
This Pull request merges the issues #322 and #127.

Summary of Changes

PhilipGutberlet and others added 26 commits May 26, 2023 15:57
…e multiple schemas into one

feat: Added ability to `Table.add_row` and `Table.add_rows` to allow new rows with different schemas
feat: Added the method `Row.sort_columns` to sort the columns in a row
Co-authored-by: alex-senger <91055000+alex-senger@users.noreply.github.com>
…_row-and-add_rows-should-not-raise-if-schemata-differ

� Conflicts:
�	tests/safeds/data/tabular/containers/_table/test_from_rows.py
refactor: Sytisfied the linters

Co-authored-by: alex-senger <91055000+alex-senger@users.noreply.github.com>
…s-when-initializing-column-or-table' into 322-detected-the-true-columntypes-when-initializing-column-or-table

# Conflicts:
#	src/safeds/data/tabular/typing/_column_type.py
#	tests/safeds/data/tabular/typing/test_column_type.py
…d still get correct schema by Columns with numbers and missing values
Co-authored-by: sibre28 <86068340+sibre28@users.noreply.github.com>
…not-raise-if-schemata-differ' into 404-merge-issues-322-and-127

# Conflicts:
#	src/safeds/data/tabular/containers/_table.py
#	tests/safeds/data/tabular/containers/_table/test_add_row.py
#	tests/safeds/data/tabular/containers/_table/test_add_rows.py
…s-when-initializing-column-or-table' into 404-merge-issues-322-and-127

# Conflicts:
#	tests/safeds/data/tabular/typing/test_schema.py
Co-authored-by: sibre28 <86068340+sibre28@users.noreply.github.com>
Co-authored-by: sibre28 <86068340+sibre28@users.noreply.github.com>
Co-authored-by: sibre28 <86068340+sibre28@users.noreply.github.com>
Co-authored-by: sibre28 <86068340+sibre28@users.noreply.github.com>
@alex-senger alex-senger requested a review from a team as a code owner July 7, 2023 08:19
@alex-senger alex-senger linked an issue Jul 7, 2023 that may be closed by this pull request
alex-senger and others added 2 commits July 7, 2023 10:57
Co-authored-by: sibre28 <86068340+sibre28@users.noreply.github.com>
…ge-issues-322-and-127

# Conflicts:
#	src/safeds/data/tabular/containers/_column.py
#	src/safeds/data/tabular/containers/_row.py
#	src/safeds/data/tabular/containers/_table.py
@Marsmaennchen221
Copy link
Contributor

Marsmaennchen221 commented Jul 11, 2023

I don't have an idea how to cover the abstract initializer of Columntype for CodeCoverage. We cannot simply remove the initializer, as it is needed for the Linter in the merge_multiple_schemas method.

Currently every abstract method we have has a docstring block instead of a pass. Try this to satisfy CodeCoverage. @alex-senger

src/safeds/data/tabular/containers/_table.py Outdated Show resolved Hide resolved
src/safeds/data/tabular/containers/_table.py Outdated Show resolved Hide resolved
src/safeds/data/tabular/containers/_row.py Outdated Show resolved Hide resolved
src/safeds/data/tabular/containers/_row.py Outdated Show resolved Hide resolved
src/safeds/data/tabular/containers/_row.py Outdated Show resolved Hide resolved
src/safeds/data/tabular/typing/_column_type.py Outdated Show resolved Hide resolved
@alex-senger alex-senger removed the request for review from lars-reimann July 11, 2023 12:53
@Marsmaennchen221
Copy link
Contributor

It seems like we do not use the SchemaMismatchError anymore. If we want to keep this error because we might need it in the future, we have to add a test like this:

import pytest

from safeds.exceptions import SchemaMismatchError


def test_should_raise_schema_mismatch_error() -> None:
    with pytest.raises(SchemaMismatchError, match=r"Failed because at least two schemas didn't match."):
        raise SchemaMismatchError()

@lars-reimann Do we want to keep this error?

@lars-reimann
Copy link
Member

It seems like we do not use the SchemaMismatchError anymore. If we want to keep this error because we might need it in the future, we have to add a test like this:

import pytest

from safeds.exceptions import SchemaMismatchError


def test_should_raise_schema_mismatch_error() -> None:
    with pytest.raises(SchemaMismatchError, match=r"Failed because at least two schemas didn't match."):
        raise SchemaMismatchError()

@lars-reimann Do we want to keep this error?

If we don't use it at the moment, let's remove it. We can add it again if we ever need it.

Copy link
Contributor

@Marsmaennchen221 Marsmaennchen221 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Marsmaennchen221 Marsmaennchen221 left a comment

Choose a reason for hiding this comment

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

If you accept these changed a Series with Integer and NANs will be considered as an Integer? ColumnType. Before this would be a RealNumber?. With this changes we also convert RealNumber ColumnTypes into Integer ColumnTypes if they have no decimal places (if they end on .0) as we will not loose any information with this convertion

src/safeds/data/tabular/containers/_column.py Outdated Show resolved Hide resolved
tests/safeds/data/tabular/containers/_column/test_init.py Outdated Show resolved Hide resolved
tests/safeds/data/tabular/containers/_column/test_init.py Outdated Show resolved Hide resolved
tests/safeds/data/tabular/typing/test_schema.py Outdated Show resolved Hide resolved
@alex-senger alex-senger merged commit 6e9ff69 into main Jul 12, 2023
8 checks passed
@alex-senger alex-senger deleted the 404-merge-issues-322-and-127 branch July 12, 2023 17:00
lars-reimann pushed a commit that referenced this pull request Jul 13, 2023
## [0.15.0](v0.14.0...v0.15.0) (2023-07-13)

### Features

* Add copy method for tables ([#405](#405)) ([72e87f0](72e87f0)), closes [#275](#275)
* add gaussian noise to image ([#430](#430)) ([925a505](925a505)), closes [#381](#381)
* add schema conversions when adding new rows to a table and schema conversion when creating a new table ([#432](#432)) ([6e9ff69](6e9ff69)), closes [#404](#404) [#322](#322) [#127](#127) [#322](#322) [#127](#127)
* add test for empty tables for the method `Table.sort_rows` ([#431](#431)) ([f94b768](f94b768)), closes [#402](#402)
* added color adjustment feature ([#409](#409)) ([2cbee36](2cbee36)), closes [#380](#380)
* added test_repr table tests ([#410](#410)) ([cb77790](cb77790)), closes [#349](#349)
* discretize table ([#327](#327)) ([5e3da8d](5e3da8d)), closes [#143](#143)
* Improve error handling of TaggedTable ([#450](#450)) ([c5da544](c5da544)), closes [#150](#150)
* Maintain tagging in methods inherited from `Table` class ([#332](#332)) ([bc73a6c](bc73a6c)), closes [#58](#58)
* new error class `OutOfBoundsError` ([#438](#438)) ([1f37e4a](1f37e4a)), closes [#262](#262)
* rename several `Table` methods for consistency ([#445](#445)) ([9954986](9954986)), closes [#439](#439)
* suggest similar columns if column gets accessed that doesnt exist ([#385](#385)) ([6a097a4](6a097a4)), closes [#203](#203)

### Bug Fixes

* added the missing ids in parameterized tests ([#412](#412)) ([dab6419](dab6419)), closes [#362](#362)
* don't warn if `Imputer` transforms column without missing values ([#448](#448)) ([f0cb6a5](f0cb6a5))
* Warnings raised by underlying seaborn and numpy libraries  ([#425](#425)) ([c4143af](c4143af)), closes [#357](#357)
@lars-reimann
Copy link
Member

🎉 This PR is included in version 0.15.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lars-reimann lars-reimann added the released Included in a release label Jul 13, 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
7 participants