diff --git a/.github/deploy_manylinux.sh b/.github/deploy_manylinux.sh index 1437635481be..346641b4d59e 100644 --- a/.github/deploy_manylinux.sh +++ b/.github/deploy_manylinux.sh @@ -8,7 +8,7 @@ ls -la rm py-polars/README.md cp README.md py-polars/README.md cd py-polars -rustup override set nightly-2023-03-09 +rustup override set nightly-2023-03-10 export RUSTFLAGS='-C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma' # first the default release diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index d74aad042746..b74cb461cd1b 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -51,7 +51,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2023-03-09 + toolchain: nightly-2023-03-10 - name: Cache Rust uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/build-test-rust.yml b/.github/workflows/build-test-rust.yml index d3cb6e2a062f..85b1fa5efadb 100644 --- a/.github/workflows/build-test-rust.yml +++ b/.github/workflows/build-test-rust.yml @@ -34,7 +34,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2023-03-09 + toolchain: nightly-2023-03-10 - name: Cache Rust uses: Swatinem/rust-cache@v2 @@ -58,7 +58,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2023-03-09 + toolchain: nightly-2023-03-10 components: rustfmt, clippy, miri - name: Cache Rust @@ -102,7 +102,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2023-03-09 + toolchain: nightly-2023-03-10 - name: Cache Rust uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/create-python-release.yml b/.github/workflows/create-python-release.yml index dbfb5799794c..dddeb0950889 100644 --- a/.github/workflows/create-python-release.yml +++ b/.github/workflows/create-python-release.yml @@ -29,7 +29,7 @@ jobs: MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma with: - rust-toolchain: nightly-2023-03-09 + rust-toolchain: nightly-2023-03-10 maturin-version: '0.14.10' command: publish args: -m py-polars/Cargo.toml --skip-existing -o wheels -u ritchie46 @@ -54,7 +54,7 @@ jobs: MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} JEMALLOC_SYS_WITH_LG_PAGE: 16 with: - rust-toolchain: nightly-2023-03-09 + rust-toolchain: nightly-2023-03-10 target: aarch64-unknown-linux-gnu maturin-version: '0.14.10' command: publish @@ -85,7 +85,7 @@ jobs: MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma with: - rust-toolchain: nightly-2023-03-09 + rust-toolchain: nightly-2023-03-10 maturin-version: '0.14.10' command: publish args: -m py-polars/Cargo.toml --skip-existing -o wheels -u ritchie46 @@ -112,7 +112,7 @@ jobs: MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt --cfg use_mimalloc with: - rust-toolchain: nightly-2023-03-09 + rust-toolchain: nightly-2023-03-10 maturin-version: '0.14.10' command: publish args: -m py-polars/Cargo.toml --skip-existing -o wheels -u ritchie46 @@ -141,7 +141,7 @@ jobs: MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+sse4.1,+sse4.2 with: - rust-toolchain: nightly-2023-03-09 + rust-toolchain: nightly-2023-03-10 maturin-version: '0.14.10' command: publish args: -m py-polars/Cargo.toml --no-sdist --skip-existing -o wheels -i python -u ritchie46 @@ -162,7 +162,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2023-03-09 + toolchain: nightly-2023-03-10 - name: Set up Rust targets run: rustup target add aarch64-apple-darwin @@ -194,7 +194,7 @@ jobs: # - name: Set up Rust # uses: dtolnay/rust-toolchain@master # with: - # toolchain: nightly-2023-03-09 + # toolchain: nightly-2023-03-10 # - name: Set up Rust targets # run: rustup target add aarch64-apple-darwin diff --git a/.github/workflows/docs-deploy-rust.yml b/.github/workflows/docs-deploy-rust.yml index c48bf981f704..4d2da628b4c5 100644 --- a/.github/workflows/docs-deploy-rust.yml +++ b/.github/workflows/docs-deploy-rust.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2023-03-09 + toolchain: nightly-2023-03-10 components: rust-docs - name: Cache Rust diff --git a/.github/workflows/lint-python.yml b/.github/workflows/lint-python.yml index cb0599705d0e..0f22fcdea91d 100644 --- a/.github/workflows/lint-python.yml +++ b/.github/workflows/lint-python.yml @@ -51,7 +51,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2023-03-09 + toolchain: nightly-2023-03-10 components: rustfmt, clippy - name: Cache Rust diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 343a7ba334ed..f4b00c3ac80e 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -46,7 +46,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2023-03-09 + toolchain: nightly-2023-03-10 - name: Cache Rust uses: Swatinem/rust-cache@v2 @@ -109,7 +109,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2023-03-09 + toolchain: nightly-2023-03-10 - name: Cache Rust uses: Swatinem/rust-cache@v2 diff --git a/py-polars/polars/internals/dataframe/frame.py b/py-polars/polars/internals/dataframe/frame.py index 1e86f042062b..f06d09445734 100644 --- a/py-polars/polars/internals/dataframe/frame.py +++ b/py-polars/polars/internals/dataframe/frame.py @@ -8030,11 +8030,10 @@ def corr(self, **kwargs: Any) -> Self: └──────┴──────┴──────┘ """ + corr = np.corrcoef(self, **kwargs) + names = self.columns return self._from_pydf( - DataFrame( - np.corrcoef(self, **kwargs), - schema=self.columns, - )._df + DataFrame([pli.Series(names[i], corr[i, :]) for i in range(len(names))])._df ) def merge_sorted(self, other: DataFrame, key: str) -> Self: diff --git a/py-polars/tests/unit/operations/test_statistics.py b/py-polars/tests/unit/operations/test_statistics.py new file mode 100644 index 000000000000..e2dc8a5903ba --- /dev/null +++ b/py-polars/tests/unit/operations/test_statistics.py @@ -0,0 +1,14 @@ +import polars as pl + + +def test_corr() -> None: + df = pl.DataFrame( + { + "a": [1, 2, 4], + "b": [-1, 23, 8], + } + ) + assert df.corr().to_dict(False) == { + "a": [1.0, 0.18898223650461357], + "b": [0.1889822365046136, 1.0], + } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 6cf1d60aab8b..3b8e077bde55 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2023-03-09" +channel = "nightly-2023-03-10"