Beispiel #1
0
        private static bool can_cast(object from_, dtype to, string casting = "safe")
        {
            dtype from = null;

            if (from_ is dtype)
            {
                from = from_ as dtype;
            }
            else
            {
                try
                {
                    var arr = asanyarray(from_);
                    if (arr != null)
                    {
                        from = arr.Dtype;
                    }
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }

            return(NpyCoreApi.CanCastTo(from, to));
        }