linearmodels.iv.data.IVData¶
-
class linearmodels.iv.data.IVData(x: IVData | ndarray | DataArray | DataFrame | Series | list[Any] | tuple[Any, ...] | None, var_name: str =
'x', nobs: int | None =None, convert_dummies: bool =True, drop_first: bool =True)[source]¶ Type abstraction for use in univariate models.
- Parameters:¶
- x: IVData | ndarray | DataArray | DataFrame | Series | list[Any] | tuple[Any, ...] | None¶
Data to wrap and standardize. Anything that is not a pandas Series or DataFrame, an xarray DataArray or an IVData, such as a list or a tuple, is converted using
np.asarray. ATypeErroris raised if the data are complex or cannot be converted to float64. If None, then nobs must be provided to produce an IVData instance with shape (nobs, 0).- var_name: str =
'x'¶ Variable name to use when naming variables in NumPy arrays or xarray DataArrays. The default is
"x".- nobs: int | None =
None¶ Number of observations, used when x is None. If x is array_like, then nobs is used to check the number of observations in x.
- convert_dummies: bool =
True¶ Flag indicating whether pandas categoricals or string input data should be converted to dummy variables. The default is True.
- drop_first: bool =
True¶ Flag indicating to drop the first dummy category. The default is True.
- Raises:¶
ValueError – If x is None and nobs is not provided, if x has more than two dimensions, if the number of observations in x is not nobs, if a DataFrame has duplicate column names or has a column that is not numeric, string or categorical.
TypeError – If x is complex or cannot be converted to float64.
Methods
drop(locs)Drop rows in place.
Properties
Return the column labels.
Return a Series that is True for the rows that contain a missing value.
Return a dictionary containing row and column labels keyed by axis.
Return an ndarray view of the data, which is always 2d.
Return the number of dimensions.
Return a DataFrame view of the data.
Return the row labels (index).
Return the shape of the data as a tuple.