null
Python pandas unique value ignoring NaN
Define a function: def unique_non_null(s): return s.dropna().unique() Then use it in the aggregation: df.groupby(‘b’).agg({ ‘a’: [‘min’, ‘max’, unique_non_null], ‘c’: [‘first’, ‘last’, unique_non_null] })
Error checking for NULL in VBScript, getting “Object Required”
From your code, it looks like provider is a variant or some other variable, and not an object. Is Nothing is for objects only, yet later you say it’s a value that should either be NULL or NOT NULL, which would be handled by IsNull. Try using: If Not IsNull(provider) Then url = url & … Read more
How do I represent an Optional String in Go?
A logical solution would be to use *string as mentioned by Ainar-G. This other answer details the possibilities of obtaining a pointer to a value (int64 but the same works for string too). A wrapper is another solution. Using just string An optional string means a string plus 1 specific value (or state) saying “not … Read more
Cast null value to a type
According to the documentation (Explicit conversions) you can cast from a base type to a derived type. Since null is a valid value for all reference types, as long as the cast route exists you should be fine. object null → TestClass null works as object is a superclass to all reference types. However, if … Read more
check against: null vs default()?
There’s no difference. The default value of any reference type is null. MSDN’s C# reference page for default keyword: https://msdn.microsoft.com/en-us/library/25tdedf5.aspx.
Collection class that doesn’t allow null elements?
Use Constraints: import com.google.common.collect.Constraints; … Constraints.constrainedList(new ArrayList(), Constraints.notNull()) from Guava for maximum flexibility. UPDATE: Guava Constraints has been deprecated in Release 15 – apparently without replacement. UPDATE 2: As of now (Guava 19.0-rc2) Constrains is still there and not deprecated anymore. However, it’s missing from the Javadoc. I’m afraid that the Javadoc is right as … Read more
Eclipse bug? Switching on a null with only default case
This is a bug. Here’s the specified behavior for a switch statement according to the Java Language Specification, 3rd Edition: JLS 14.11 The switch Statement SwitchStatement: switch ( Expression ) SwitchBlock When the switch statement is executed, first the Expression is evaluated. If the Expression evaluates to null, a NullPointerException is thrown and the entire … Read more
Oracle SQL – max() with NULL values
max(end_dt) keep (dense_rank first order by end_dt desc nulls first) upd: SQL Fiddle Oracle 11g R2 Schema Setup: CREATE TABLE t (val int, s date, e date) ; INSERT ALL INTO t (val, s, e) VALUES (1, sysdate-3, sysdate-2) INTO t (val, s, e) VALUES (1, sysdate-2, sysdate-1) INTO t (val, s, e) VALUES (1, … Read more
Null Coalescing Operator in F#?
Yes, using some minor hackery found in this SO answer “Overload operator in F#”. At compiled time the correct overload for an usage of either (‘a Nullable, ‘a) ->’a or (‘a when ‘a:null, ‘a) -> ‘a for a single operator can be inlined. Even (‘a option, ‘a) -> ‘a can be thrown in for more … Read more