diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 53b96de..6d215e9 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -18,6 +18,14 @@ jobs: matrix: os: [ubuntu-latest] py: ['3.8', '3.9', '3.10', '3.11'] + pandas: [ '1.*' ] + include: + - os: ubuntu-latest + py: '3.10' + pandas: '1.3' + - os: ubuntu-latest + py: '3.10' + pandas: '1.4' steps: - uses: actions/checkout@v3 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index aa6d6d1..6e58176 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,15 @@ # pytcs -## unreleased +## v0.1.2 + +### added - add support for reading `StringIO` and `BytesIO` #10 +### fixed + +- explicitly sort index in `ScopeFile.as_pandas` #16 + ## v0.1.1 initial release with basic functions diff --git a/pytcs/pytcs.py b/pytcs/pytcs.py index 9e01628..fa287cd 100644 --- a/pytcs/pytcs.py +++ b/pytcs/pytcs.py @@ -306,7 +306,7 @@ def as_pandas( _list = [v for v in _dict.values() if not v.empty] - df = pd.DataFrame().join(_list, how="outer") + df = pd.DataFrame().join(_list, how="outer", sort=True) if time_fmt == "timedelta": df.index = pd.TimedeltaIndex((df.index * 1e6).astype(np.int64)) diff --git a/tests/test_scope_file.py b/tests/test_scope_file.py index 403e78b..d725bba 100644 --- a/tests/test_scope_file.py +++ b/tests/test_scope_file.py @@ -64,7 +64,9 @@ def test_scope_file(filenames, backend, native_dtypes, use_buffer): ) assert all([type(v) == np.ndarray for v in sf._data.values()]) - str(sf) + # monotonic time + for c in sf: + assert np.allclose(np.diff(sf[c].time), sf[c].sample_time) @staticmethod @pytest.mark.parametrize("backend", ["pandas"])