Hello, I get the following error when I write my Contiguity Spatial Weights matrices to my local machine:
TypeError: Expected a pysal weights object, got: <class 'pysal.lib.weights.contiguity.Queen'>
It seems like my object is being rejected even though it is a spatial weights object?
---------------------------------------------------------------------------------------------------------------------------------------------
import seaborn as sns
import pandas as pd
from pysal.lib import weights
from libpysal.io import open as psopen
import geopandas as gpd
import numpy as np
import matplotlib.pyplot as plt
w_queen = weights.Queen.from_dataframe(db, idVariable="LSOA11CD")
# Open file to write into
fo = psopen('C:/Users/Owner/Documents/GeoComputation/imd_queen.gal', 'w')
# Write the matrix into the file
fo.write(w_queen)
# Close the file
fo.close()