def na_value_for_dtype(dtype, compat=True):
dtype = pandas_dtype(dtype)<EOL>if is_extension_array_dtype(dtype):<EOL><INDENT>return dtype.na_value<EOL><DEDENT>if (is_datetime64_dtype(dtype) or is_datetime64tz_dtype(dtype) or<EOL>is_timedelta64_dtype(dtype) or is_period_dtype(dtype)):<EOL><INDENT>return NaT<EOL><DEDENT>elif is_float_dtype(dtype):<EOL><INDENT>return np.nan<EOL><DEDENT>elif is_integer_dtype(dtype):<EOL><INDENT>if compat:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>return np.nan<EOL><DEDENT>elif is_bool_dtype(dtype):<EOL><INDENT>return False<EOL><DEDENT>return np.nan<EOL>
Return a dtype compat na value

Parameters
----------
dtype : string / dtype
compat : boolean, default True

Returns
-------
np.dtype or a pandas dtype

Examples
--------
>>> na_value_for_dtype(np.dtype('int64'))
0
>>> na_value_for_dtype(np.dtype('int64'), compat=False)
nan
>>> na_value_for_dtype(np.dtype('float64'))
nan
>>> na_value_for_dtype(np.dtype('bool'))
False
>>> na_value_for_dtype(np.dtype('datetime64[ns]'))
NaT