private DataFrame ReplaceCore <T>(Dictionary <T, T> toReplaceAndValue, string[] subset) { var validTypes = new[] { typeof(int), typeof(short), typeof(long), typeof(double), typeof(float), typeof(string) }; if (!validTypes.Any(t => t == typeof(T))) { throw new ArgumentException("toReplace and value should be a float, double, short, int, long or string"); } object subsetObj; if (subset == null || subset.Length == 0) { subsetObj = "*"; } else { subsetObj = subset; } return(new DataFrame(dataFrameProxy.Replace(subsetObj, toReplaceAndValue), sparkContext)); }