File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -1292,6 +1292,15 @@ def check_dtype(vname, var):
12921292 or np .issubdtype (var .dtype , np .bool_ )
12931293 or var .dtype == object
12941294 ):
1295+ # We can skip dtype equality checks under two conditions: (1) if the var to append is
1296+ # new to the dataset, because in this case there is no existing var to compare it to;
1297+ # or (2) if var to append's dtype is known to be easy-to-append, because in this case
1298+ # we can be confident appending won't cause problems. Examples of dtypes which are not
1299+ # easy-to-append include length-specified strings of type `|S*` or `<U*` (where * is a
1300+ # positive integer character length). For these dtypes, appending dissimilar lengths
1301+ # can result in truncation of appended data. Therefore, variables which already exist
1302+ # in the dataset, and with dtypes which are not known to be easy-to-append, necessitate
1303+ # exact dtype equality, as checked below.
12951304 pass
12961305 elif not var .dtype == existing_vars [vname ].dtype :
12971306 raise ValueError (
You can’t perform that action at this time.
0 commit comments