pysal / segregation

Segregation Measurement, Inferential Statistics, and Decomposition Analysis
https://pysal.org/segregation/
BSD 3-Clause "New" or "Revised" License
111 stars 26 forks source link

Interaction Index Still Supported? #223

Closed PFurst2000 closed 7 months ago

PFurst2000 commented 7 months ago

A few months ago i ran a script for interaction index that started with the following code "from segregation.singlegroup import Interaction" but now it doesn't work. Was the package updated recently? I assume I need to replace the "from segregation.singlegroup" with something like from "segregation.aspatial" or "from segregation.spatial" but I cant identify the correct code. Is the Interaction Index still supported or categorized as something else?

jGaboardi commented 7 months ago

@PFurst2000 Can you provide both the version of segregation where that import succeeded and the version you are running now?

knaaptime commented 7 months ago

sounds like something's off. The API hasn't changed and the tests are passing (and i just imported here, just to be sure). Maybe you have an old version?

PFurst2000 commented 7 months ago

I had to delete my hard drive since I originally ran the queries so I am not sure which version I used. I downloaded it around March 2023. What I noticed was the new version I downloaded requires a script that starts with "from segregation.aspatial import Dissim" for indices such as the dissimilarity index while previously my codes started with "from segregation.singlegroup import Dissim" or "from segregation.singlegroup import Interaction"

My old interaction index started as follows: import pandas as pd import geopandas as gpd from segregation.singlegroup import Interaction

read in the shapefile

gdf = gpd.read_file...

knaaptime commented 7 months ago

you got downgraded; that's the old api. do

import segregation
segregation.__version__

and tell us what you see. the current version is 2.5, but you've got to be on 1.x

PFurst2000 commented 7 months ago

that makes sense. i think I downloaded it directly from anaconda, assuming it would the latest package.

On Fri, Dec 15, 2023 at 11:32 PM eli knaap @.***> wrote:

you got downgraded; that's the old api. do

import segregationsegregation.version

and tell us what you see. the current version is 2.5, but you've got to be on 1.x

— Reply to this email directly, view it on GitHub https://github.com/pysal/segregation/issues/223#issuecomment-1858715791, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHPA27UQCQMBPGQMBE5E5F3YJUP67AVCNFSM6AAAAABAXJFJK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJYG4YTKNZZGE . You are receiving this because you were mentioned.Message ID: @.***>

PFurst2000 commented 7 months ago

yeah its 1.3.0

On Fri, Dec 15, 2023 at 11:41 PM Peter Furst @.***> wrote:

that makes sense. i think I downloaded it directly from anaconda, assuming it would the latest package.

On Fri, Dec 15, 2023 at 11:32 PM eli knaap @.***> wrote:

you got downgraded; that's the old api. do

import segregationsegregation.version

and tell us what you see. the current version is 2.5, but you've got to be on 1.x

— Reply to this email directly, view it on GitHub https://github.com/pysal/segregation/issues/223#issuecomment-1858715791, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHPA27UQCQMBPGQMBE5E5F3YJUP67AVCNFSM6AAAAABAXJFJK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJYG4YTKNZZGE . You are receiving this because you were mentioned.Message ID: @.***>

knaaptime commented 7 months ago

sounds good. if you update to the latest, your old script should work. Otherwise, you can use the old api (if for some reason you are stuck on 1.3) and jsut import like you said i.e. from segregation.aspatial import Interaction. As long as you arent passing a W or a Network, you'll get the same results.

Feel free to respond here if you're still having trouble but im going to close this as resolved