You can create a sparse matrix in SciPy using various constructors. Here's an example of creating a Compressed Sparse Row (CSR) matrix:
import scipy.sparse as sp
data = [1, 2, 3]
row_indices = [0, 1, 2]
column_indices = [0, 1, 2]
# Create a CSR matrix
sparse_matrix = sp.csr_matrix((data, (row_indices, column_indices)), shape=(3, 3))