{"id":10356,"library":"woodwork","title":"Woodwork Data Typing Library","description":"Woodwork is a data typing library for machine learning, extending pandas DataFrames and Series with semantic and logical typing capabilities. It enables automatic data typing inference, validation, and schema management for robust data pipelines. Currently at version 0.31.0, it is actively maintained by Alteryx with frequent updates.","status":"active","version":"0.31.0","language":"en","source_language":"en","source_url":"https://github.com/alteryx/woodwork","tags":["data typing","machine learning","pandas","data preprocessing","data validation"],"install":[{"cmd":"pip install woodwork","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core data structure for Woodwork's functionality.","package":"pandas"},{"reason":"Underlying array operations for data handling.","package":"numpy"},{"reason":"Used for some statistical operations and type inference.","package":"scipy"}],"imports":[{"note":"The Woodwork accessor is automatically registered when `woodwork` is imported.","symbol":"DataFrameAccessor","correct":"import woodwork as ww\n# ... then use df.ww.method()"},{"note":"The global `woodwork.api.init` function was deprecated and removed in favor of the DataFrame accessor method `df.ww.init()` in version 0.17.0.","wrong":"from woodwork.api import init\ninit(df)","symbol":"init","correct":"df.ww.init()"},{"symbol":"LogicalType","correct":"from woodwork.logical_types import LogicalType"},{"symbol":"Categorical","correct":"from woodwork.logical_types import Categorical"}],"quickstart":{"code":"import pandas as pd\nimport woodwork as ww\n\ndata = {\n    \"id\": [1, 2, 3],\n    \"name\": [\"Alice\", \"Bob\", \"Charlie\"],\n    \"age\": [25, 30, 35],\n    \"email\": [\"alice@example.com\", \"bob@example.com\", \"charlie@example.com\"]\n}\ndf = pd.DataFrame(data)\n\n# Initialize Woodwork on the DataFrame to infer types and create a schema\ndf.ww.init()\n\nprint(df.ww.schema)\nprint(df.ww.logical_types)\nprint(df.ww['email'].ww.logical_type)","lang":"python","description":"This quickstart demonstrates how to initialize Woodwork on a pandas DataFrame, allowing it to automatically infer logical types for your columns. It then prints the inferred schema, logical types, and the specific logical type for the 'email' column."},"warnings":[{"fix":"Replace `from woodwork.api import init; init(df)` with `import woodwork as ww; df.ww.init()`.","message":"The global `woodwork.init()` function was removed and replaced by the DataFrame accessor method `df.ww.init()`.","severity":"breaking","affected_versions":">=0.17.0"},{"fix":"If you relied on `woodwork` automatically 'boxing' Series or DataFrames into Woodwork structures upon creation, you may now need to explicitly call `df.ww.init()` or set `infer_box_type_on_init=True` during initialization.","message":"The default value for `infer_box_type_on_init` parameter in `df.ww.init()` changed from `True` to `False`.","severity":"breaking","affected_versions":">=0.24.0"},{"fix":"Upgrade your Python environment to 3.9 or higher. (e.g., Python 3.9, 3.10, 3.11, etc.)","message":"Support for Python 3.8 was dropped.","severity":"breaking","affected_versions":">=0.29.0"},{"fix":"Use `df.ww.set_types(column_logical_types={'column_name': 'NewLogicalType'})` or `df.ww.set_types(logical_types={'column_name': 'NewLogicalType'})` instead.","message":"The `WoodworkColumnAccessor.set_logical_type()` method was deprecated.","severity":"deprecated","affected_versions":">=0.28.0"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure `import woodwork as ww` is at the top of your script. If the DataFrame was created before `woodwork` was imported, or if you're trying to access Woodwork properties without initialization, call `df.ww.init()` first.","cause":"The `woodwork` library needs to be imported to register its DataFrame accessor, or `df.ww.init()` has not been called.","error":"AttributeError: 'DataFrame' object has no attribute 'ww'"},{"fix":"Verify that the data in the column can be correctly interpreted by the specified logical type. Check the `woodwork.logical_types` module for valid logical type names. For example, 'Double' for floats, 'Integer' for integers, 'Categorical' for strings/categories.","cause":"Attempting to assign a logical type that is incompatible with the underlying data type of the column, or using an unrecognized logical type string.","error":"ValueError: Invalid LogicalType specified for column '...' with value '...'"},{"fix":"Manually specify the logical type for the problematic column using `df.ww.set_types(logical_types={'column_name': 'YourLogicalType'})` after calling `df.ww.init()`.","cause":"Woodwork failed to automatically determine a suitable logical type for a column based on its data.","error":"TypeError: Cannot infer LogicalType from '...'"}]}