{"id":23788,"library":"giddy","title":"giddy","description":"PySAL-giddy is a Python library for exploratory spatiotemporal data analysis, providing methods such as spatial Markov chains, rank-based Markov chains, and sequence analysis. Current version is 2.3.8, compatible with Python >=3.11. Releases are infrequent; the latest release was in 2025.","status":"active","version":"2.3.8","language":"python","source_language":"en","source_url":"https://github.com/pysal/giddy","tags":["spatial-analysis","spatiotemporal","markov-chains","pysal","geography"],"install":[{"cmd":"pip install giddy","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency for spatial weights and other PySAL utilities","package":"libpysal","optional":false},{"reason":"Exploratory spatial data analysis routines","package":"esda","optional":false},{"reason":"Classification schemes for mapping","package":"mapclassify","optional":true},{"reason":"Visualization support (optional, but recommended for plotting)","package":"splot","optional":true}],"imports":[{"note":"","wrong":null,"symbol":"Markov","correct":"from giddy.markov import Markov"},{"note":"","wrong":null,"symbol":"Spatial_Markov","correct":"from giddy.markov import Spatial_Markov"},{"note":"","wrong":null,"symbol":"LISA_Markov","correct":"from giddy.markov import LISA_Markov"},{"note":"","wrong":null,"symbol":"Tau","correct":"from giddy.ranking import Tau"},{"note":"","wrong":null,"symbol":"Sequence","correct":"from giddy.sequence import Sequence"},{"note":"Star imports are discouraged because the package's top-level __init__ exports many symbols; explicit imports reduce namespace pollution.","wrong":"from giddy import *","symbol":"giddy","correct":"import giddy"}],"quickstart":{"code":"import libpysal\nfrom giddy.markov import Markov, Spatial_Markov\nimport numpy as np\n\n# Create a simple transition matrix from random data\nnp.random.seed(100)\ndata = np.random.randint(0, 3, size=(10, 5))\nm = Markov(data)\nprint(m.p)\nprint(m.classes)\n\n# For spatial Markov, we need spatial weights\nw = libpysal.weights.util.lat2W(4, 4)\n# Ensure same number of spatial units as rows in data\n# (this example is illustrative; actual use requires matching dimensions)","lang":"python","description":"Basic usage of Markov and Spatial_Markov classes."},"warnings":[{"fix":"Update imports from 'splot' to 'giddy.viz'. For example, replace 'from splot.giddy import ...' with 'from giddy.viz import ...'.","message":"In version 2.3.8, splot visualization code was moved into giddy itself. Previous imports from splot will break. Use giddy.viz instead.","severity":"breaking","affected_versions":"<2.3.8"},{"fix":"Replace calls to giddy.mobility functions with the relevant Markov class methods (e.g., Markov.mobility).","message":"The old 'giddy.mobility' module (functions like 'mobility_metrics') is deprecated and may be removed in future versions. Use 'giddy.markov' classes instead.","severity":"deprecated","affected_versions":">=2.3.0"},{"fix":"Ensure the weights object's 'n' attribute matches the number of rows in the data matrix.","message":"Spatial_Markov requires a spatial weights object with the same number of observations as the data. Mismatched dimensions cause obscure errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Check the 'fill_value' parameter in Markov.__init__ and set it to 0 if desired.","message":"The default fill value for missing transitions in Markov chains is set to a small epsilon, not zero. This can affect results when comparing with other implementations.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use 'from giddy.markov import Spatial_Markov' instead of 'from giddy import Spatial_Markov'.","cause":"The symbol is not exported at the package level; it must be imported from the submodule.","error":"ImportError: cannot import name 'Spatial_Markov' from 'giddy'"},{"fix":"Ensure the input data is a 2D numpy array or rectangular list of lists with consistent dimensions.","cause":"Often occurs when providing ragged data (lists of different lengths) to Markov or Spatial_Markov.","error":"ValueError: setting an array element with a sequence."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}