From 78e6a70cc9e0ee5138ef60455e97c4af4dd47e69 Mon Sep 17 00:00:00 2001 From: Reuben Gardos Reid <5456207+ReubenJ@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:48:23 +0100 Subject: [PATCH 1/4] Add failing tests for `TableTrait` functions --- test/test_tabletraits.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/test_tabletraits.jl b/test/test_tabletraits.jl index f2e4893..7294d6c 100644 --- a/test/test_tabletraits.jl +++ b/test/test_tabletraits.jl @@ -57,4 +57,11 @@ it3_collected = collect(IteratorInterfaceExtensions.getiterator(df3)) cols3 = TableTraits.get_columns_copy_using_missing(df3) @test isequal(cols3, (a=[NaN,2.], b=["John", "Sally"], c=[3.2, NaN])) +# Create a non-standard index in the python representation +df4 = DataFrame(["a",]; index=[1,], columns=[:x]) +cols4 = TableTraits.get_columns_copy_using_missing(df4) +@test length(cols4) == 1 +it4 = IteratorInterfaceExtensions.getiterator(df4) +@test length(it4) == 1 + end From 07c35b3a651c306cd3d7c7677337e413cdd042e5 Mon Sep 17 00:00:00 2001 From: Reuben Gardos Reid <5456207+ReubenJ@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:50:19 +0100 Subject: [PATCH 2/4] Fix `TableTrait` functions for non-standard indices --- src/tabletraits.jl | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/tabletraits.jl b/src/tabletraits.jl index 42fb58c..8d48146 100644 --- a/src/tabletraits.jl +++ b/src/tabletraits.jl @@ -7,10 +7,8 @@ IteratorInterfaceExtensions.isiterable(x::DataFrame) = true TableTraits.isiterabletable(x::DataFrame) = true function TableTraits.getiterator(df::DataFrame) - col_names_raw = [i for i in Pandas.columns(df)] - col_names = Symbol.(col_names_raw) - - column_data = [eltype(df[i])==String ? [df[i][j] for j=1:length(df)] : values(df[i]) for i in col_names_raw] + col_names = Symbol.(Pandas.columns(df)) + column_data = ([df[i]...] for i in col_names) return create_tableiterator(column_data, col_names) end @@ -19,10 +17,10 @@ TableTraits.supports_get_columns_copy_using_missing(df::DataFrame) = true function TableTraits.get_columns_copy_using_missing(df::Pandas.DataFrame) # return a named tuple of columns here - col_names_raw = [i for i in Pandas.columns(df)] - col_names = Symbol.(col_names_raw) - cols = (Array(eltype(df[i])==String ? [df[i][j] for j=1:length(df)] : df[i]) for i in col_names_raw) - return NamedTuple{tuple(col_names...)}(tuple(cols...)) + col_names = Symbol.(Pandas.columns(df)) + column_data = Tuple([df[i]...] for i in col_names) + + return NamedTuple(col_names .=> column_data) end function _construct_pandas_from_iterabletable(source) From 4610dbdc47857a193e5072a1c67d237f02be1e19 Mon Sep 17 00:00:00 2001 From: Reuben Gardos Reid <5456207+ReubenJ@users.noreply.github.com> Date: Sun, 22 Dec 2024 18:03:34 +0100 Subject: [PATCH 3/4] Bump patch version number --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 82b331d..d9a2cff 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Pandas" uuid = "eadc2687-ae89-51f9-a5d9-86b5a6373a9c" -version = "1.6.1" +version = "1.6.2" [deps] Compat = "34da2185-b29b-5c13-b0c7-acf172513d20" From e0ac79bcd47f56a7624fb5f83723048906b07d39 Mon Sep 17 00:00:00 2001 From: Reuben Gardos Reid <5456207+ReubenJ@users.noreply.github.com> Date: Mon, 23 Dec 2024 11:46:44 +0100 Subject: [PATCH 4/4] Update workflow action versions --- .github/workflows/ci.yml | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dabf4b1..0120ed7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,10 +31,10 @@ jobs: Python ${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.architecture }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup python - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.architecture }} @@ -42,7 +42,7 @@ jobs: - run: python -m pip install pandas - name: Setup julia - uses: julia-actions/setup-julia@v1 + uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} arch: ${{ matrix.architecture }} @@ -51,21 +51,11 @@ jobs: env: PYTHON: python - - uses: actions/cache@v1 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- - + - uses: julia-actions/cache@v2 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v5 with: - file: ./lcov.info + files: ./lcov.info flags: unittests name: codecov-umbrella