String (@NotNull String varName, @NotNull ColumnFilter filter) { if (filter.isSubstring()) { return String.format("%1$s[%1$s.apply(str).str.contains('%2$s', regex=%3$s)]", varName, filter.getFilter(), filter.isRegex() ? "True" : "False"); } return String.format("%1$s[%1$s.apply(lambda %3$s: bool(%2$s))]", varName, filter.getFilter(), ColumnFilter.VAR_ALIAS); }