id
stringlengths
16
145
text
stringlengths
1
179k
title
stringclasses
1 value
scipy_io/scipysparsesavenpzht_44_0.txt
© Copyright 2008-2024, The SciPy community.
scipy_io/scipysparsesavenpzht_16_0.txt
Either the file name (string) or an open file (file-like object) where the data will be saved. If file is a string, the ` .npz ` extension will be appended to the file name if it is not already there.
scipy_io/scipysparsesavenpzht_23_0.txt
Load a sparse matrix from a file using ` .npz ` format.
scipy_io/844_16_0.txt
* Open Source
scipy_io/7510_119_0.txt
> In general, the rule we try to follow is: if you replace the sparse matrix > with a numpy matrix, the resulting type should not change (unless the result > itself is sparse).
scipy_io/844_47_0.txt
**Have a question about this project?** Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
scipy_io/844_87_0.txt
[ ![@swzCuroverse](https://avatars.githubusercontent.com/u/15944983?s=80&u=02b888e09a02a8239a3789bee4f62df3a1074388&v=4) ](/swzCuroverse)
scipy_io/scipysparsesavenpzht_7_0.txt
* [ __ GitHub ](https://github.com/scipy/scipy "GitHub") * [ __ Twitter ](https://twitter.com/SciPy_team "Twitter")
scipy_io/7510_16_0.txt
* Open Source
scipy_io/844_122_0.txt
**[ swzCuroverse ](/swzCuroverse) ** commented Sep 10, 2020 •
scipy_io/7510_81_0.txt
---
scipy_io/844_90_0.txt
###
scipy_io/7510_154_0.txt
[ @perimosocordiae ](https://github.com/perimosocordiae) Hi, is there any work going on to fix the bug you outlined above?
scipy_io/844_60_0.txt
Copy link
scipy_io/scipysparsesavenpzht_14_0.txt
Parameters :
scipy_io/844_118_0.txt
[ ![@swzCuroverse](https://avatars.githubusercontent.com/u/15944983?s=80&u=02b888e09a02a8239a3789bee4f62df3a1074388&v=4) ](/swzCuroverse)
scipy_io/7510_158_0.txt
Sorry, something went wrong.
scipy_io/7510_96_0.txt
All reactions
scipy_io/scipy_io_0_0.txt
[ SciPy v1.12.0 Manual ](../../index.html) * [ Installing ](https://scipy.org/install/) * [ User Guide ](../../tutorial/index.html) * [ API reference ](../index.html) * [ Building from source ](../../building/index.html) * [ Development ](../../dev/index.html) * [ Release notes ](../../release.html) __ _...
scipy_io/7510_45_0.txt
* [ Code ](/scipy/scipy) * [ Issues ](/scipy/scipy/issues) * [ Pull requests ](/scipy/scipy/pulls) * [ Actions ](/scipy/scipy/actions) * [ Projects ](/scipy/scipy/projects) * [ Wiki ](/scipy/scipy/wiki) * [ Security ](/scipy/scipy/security) * [ Insights ](/scipy/scipy/pulse)
scipy_io/7510_175_0.txt
All reactions
scipy_io/scipysparsesavenpzht_12_0.txt
scipy.sparse. save_npz ( _ file _ , _ matrix _ , _ compressed = True _ ) [ [source] ](https://github.com/scipy/scipy/blob/v1.13.0/scipy/sparse/_matrix_io.py#L11-L77) #
scipy_io/7510_88_0.txt
edited
scipy_io/7510_142_0.txt
In general, I agree that users should avoid ` numpy.matrix ` whenever possible. Unfortunately, the ` scipy.sparse ` API design decision to mimic ` numpy.matrix ` can't be changed now. There's a growing list of efforts to produce a sparse ndarray-like library that may someday make it into scipy, but that will take consi...
scipy_io/7510_148_0.txt
Sorry, something went wrong.
scipy_io/sparsesavenpzhtml_14_0.txt
Examples
scipy_io/7510_194_0.txt
You can’t perform that action at this time.
scipy_io/scipy_io_9_0.txt
[ SciPy v1.12.0 Manual ](../../index.html) * [ Installing ](https://scipy.org/install/) * [ User Guide ](../../tutorial/index.html) * [ API reference ](../index.html) * [ Building from source ](../../building/index.html) * [ Development ](../../dev/index.html) * [ Release notes ](../../release.html) __ _...
scipy_io/scipy_io_11_0.txt
[ SciPy v1.12.0 Manual ](../../index.html) * [ Installing ](https://scipy.org/install/) * [ User Guide ](../../tutorial/index.html) * [ API reference ](../index.html) * [ Building from source ](../../building/index.html) * [ Development ](../../dev/index.html) * [ Release notes ](../../release.html) __ _...
scipy_io/844_9_0.txt
* Solutions
scipy_io/7510_95_0.txt
👍 2 ngazagna and christian-cahig reacted with thumbs up emoji
scipy_io/844_107_0.txt
All reactions
scipy_io/sparsesavenpzhtml_0_0.txt
[ sparse ![Logo](../_static/logo.svg) ](../index.html)
scipy_io/7510_164_0.txt
[ gh-7826 ](https://github.com/scipy/scipy/issues/7826) has more discussion of that particular problem, and why it's not trivial to fix. I like the suggestion in [ #7826 (comment) ](https://github.com/scipy/scipy/issues/7826#issuecomment-437642900) about raising a warning, though.
scipy_io/7510_107_0.txt
---
scipy_io/7510_171_0.txt
###
scipy_io/sparsesavenpzhtml_26_0.txt
Downloads
scipy_io/scipysparsesavenpzht_30_0.txt
Store sparse matrix to disk, and load it again:
scipy_io/sparsesavenpzhtml_23_0.txt
Read the Docs v: stable
scipy_io/7510_51_0.txt
Jump to bottom
scipy_io/844_53_0.txt
Open
scipy_io/844_117_0.txt
Sorry, something went wrong.
scipy_io/7510_32_0.txt
## Use saved searches to filter your results more quickly
scipy_io/844_54_0.txt
[ swzCuroverse ](/swzCuroverse) opened this issue Sep 10, 2020 · 5 comments
scipy_io/844_116_0.txt
All reactions
scipy_io/scipysparsesavenpzht_31_0.txt
>>> import numpy as np >>> import scipy as sp >>> sparse_matrix = sp.sparse.csc_matrix([[0, 0, 3], [4, 0, 0]]) >>> sparse_matrix <2x3 sparse matrix of type '<class 'numpy.int64'>' with 2 stored elements in Compressed Sparse Column format> >>> sparse_matrix.toarray() array([[0, 0, 3], [4, 0, 0]], dtype=int64)
scipy_io/844_63_0.txt
edited
scipy_io/scipysparsesavenpzht_32_0.txt
>>> sp.sparse.save_npz('/tmp/sparse_matrix.npz', sparse_matrix) >>> sparse_matrix = sp.sparse.load_npz('/tmp/sparse_matrix.npz')
scipy_io/7510_184_0.txt
Milestone
scipy_io/7510_55_0.txt
Closed
scipy_io/844_103_0.txt
###
scipy_io/sparsesavenpzhtml_10_0.txt
Parameters :
scipy_io/844_81_0.txt
**[ kevinushey ](/kevinushey) ** commented Sep 10, 2020
scipy_io/sparsesavenpzhtml_21_0.txt
© Copyright 2018, Sparse developers. Revision ` 51e61337 ` .
scipy_io/7510_112_0.txt
[ ![@perimosocordiae](https://avatars.githubusercontent.com/u/82855?s=40&v=4) ](/perimosocordiae) [ perimosocordiae ](/perimosocordiae) added [ defect ](/scipy/scipy/labels/defect) A clear bug or issue that prevents SciPy from being installed or used as expected [ scipy.sparse ](/scipy/scipy/labels/scipy.sparse) label...
scipy_io/7510_2_0.txt
Toggle navigation
scipy_io/sparsesavenpzhtml_2_0.txt
* [ Install ](../install.html) * [ Getting Started ](../quickstart.html) * [ Construct Sparse Arrays ](../construct.html) * [ Operations on ` COO ` and ` GCXS ` arrays ](../operations.html) * [ API ](sparse.html) * [ COO ](sparse.COO.html) * [ DOK ](sparse.DOK.html) * [ GCXS ](sparse.GCXS.html) * [ SparseArray ](spar...
scipy_io/7510_92_0.txt
numpy_array -= scipy_sparse_matrix
scipy_io/7510_42_0.txt
* * [ Notifications ](/login?return_to=%2Fscipy%2Fscipy) * [ Fork 5k ](/login?return_to=%2Fscipy%2Fscipy) * [ Star 12.5k ](/login?return_to=%2Fscipy%2Fscipy)
scipy_io/7510_126_0.txt
> (unless the result itself is sparse).
scipy_io/sparsesavenpzhtml_17_0.txt
See also
scipy_io/scipysparsesavenpzht_1_0.txt
__ Back to top
scipy_io/844_136_0.txt
No milestone
scipy_io/scipy_io_14_1.txt
implied by the symmetry. >>> z = np.array([[3, 1+2j, 4-3j], [1-2j, 1, -5j], [4+3j, 5j, 2.5]]) >>> z array([[ 3. +0.j, 1. +2.j, 4. -3.j], [ 1. -2.j, 1. +0.j, -0. -5.j], [ 4. +3.j, 0. +5.j, 2.5+0.j]]) >>> target = BytesIO() >>> mmwrite(target, z, pr...
scipy_io/7510_56_0.txt
# Operations between numpy.array and scipy.sparse matrix return inconsistent array type #7510
scipy_io/scipy_io_12_0.txt
[ SciPy v1.12.0 Manual ](../../index.html) * [ Installing ](https://scipy.org/install/) * [ User Guide ](../../tutorial/index.html) * [ API reference ](../index.html) * [ Building from source ](../../building/index.html) * [ Development ](../../dev/index.html) * [ Release notes ](../../release.html) __ _...
scipy_io/7510_10_0.txt
For
scipy_io/844_84_0.txt
---
scipy_io/scipysparsesavenpzht_0_0.txt
Skip to main content
scipy_io/7510_156_0.txt
---
scipy_io/scipysparsesavenpzht_43_0.txt
* ` save_npz `
scipy_io/7510_114_0.txt
[ ![@dhimmel](https://avatars.githubusercontent.com/u/1117703?s=80&u=d0385705e084bf1e92d117c03a50aeb25cba9725&v=4) ](/dhimmel)
scipy_io/scipysparsesavenpzht_8_0.txt
Section Navigation
scipy_io/7510_73_0.txt
mat = np.array([[1,1], [1,0]]) sp_mat = csc_matrix([[1,1], [1,0]])
scipy_io/7510_153_0.txt
**[ evfro ](/evfro) ** commented Apr 14, 2020
scipy_io/7510_83_0.txt
All reactions
scipy_io/7510_146_0.txt
All reactions
scipy_io/7510_25_0.txt
Clear
scipy_io/7510_67_0.txt
It appears that adding or subtracting numpy.ndarrays with scipy.sparse matrices returns a numpy.matrix.
scipy_io/7510_74_0.txt
mat + mat >>> array([[2, 2], [2, 0]])
scipy_io/7510_64_0.txt
Copy link
scipy_io/844_52_0.txt
# Error when loading sparse array from numpy (npz) file #844
scipy_io/844_39_0.txt
You signed in with another tab or window. [ Reload ]() to refresh your session. You signed out in another tab or window. [ Reload ]() to refresh your session. You switched accounts on another tab or window. [ Reload ]() to refresh your session. Dismiss alert
scipy_io/sparsesavenpzhtml_4_0.txt
__ [ sparse ](../index.html)
scipy_io/844_98_0.txt
All reactions
scipy_io/7510_40_0.txt
{{ message }}
scipy_io/844_31_0.txt
# Saved searches
scipy_io/844_22_0.txt
Search or jump to...
scipy_io/sparsesavenpzhtml_5_0.txt
* [ ](../index.html) * [ API ](sparse.html) * save_npz * [ Edit on GitHub ](https://github.com/pydata/sparse/blob/51e61337b9a1631127a3901a37151cd94249c840/docs/generated/sparse.save_npz.rst)
scipy_io/844_3_0.txt
[ ](https://github.com/)
scipy_io/844_79_0.txt
Collaborator
scipy_io/844_66_0.txt
Error in validObject(.Object) : invalid class "dgRMatrix" object: invalid object for slot "Dim" in class "dgRMatrix": got class "numeric", should be or extend class "integer
scipy_io/7510_129_0.txt
> Despite its convenience, the use of the ` numpy.matrix ` class is > discouraged, since it adds nothing that cannot be accomplished with 2D > numpy.ndarray objects, and may lead to a confusion of which class is being > used.
scipy_io/7510_179_0.txt
No one assigned
scipy_io/844_4_0.txt
[ Sign in ](/login?return_to=https%3A%2F%2Fgithub.com%2Frstudio%2Freticulate%2Fissues%2F844)
scipy_io/7510_63_0.txt
[ ![@zietzm](https://avatars.githubusercontent.com/u/7230303?s=80&u=be3a20a0983b9b1427a98a6e5da4c996a1bab7c4&v=4) ](/zietzm)
scipy_io/scipy_io_4_1.txt
When writing data to a NetCDF file, there is often the need to indicate the ‘record dimension’. A record dimension is the unbounded dimension for a variable. For example, a temperature variable may have dimensions of latitude, longitude and time. If one wants to add more temperature data to the NetCDF file as time...
scipy_io/scipysparsesavenpzht_2_0.txt
__ ` Ctrl ` \+ ` K `
scipy_io/844_112_0.txt
###
scipy_io/scipysparsesavenpzht_45_0.txt
Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.