public static IDataFrame DataFrame <T>(this Pandas pd, IList <T> data, IList <string> index = null) { var type = typeof(T); if (type.FullName == "System.Object") { type = data[0].GetType(); } var props = type.GetProperties(); var columnSize = props.Count(); var rowSize = data.Count(); var nd = new NDArray(typeof(object), new Shape(rowSize, columnSize)); for (var i = 0; i < rowSize; i++) { for (var p = 0; p < columnSize; p++) { nd[i, p] = props[p].GetValue(data[i]); } } return(pd.DataFrame(nd, index, props.Select(x => x.Name).ToArray(), typeof(object))); }
public static IDataFrame DataFrame(this Pandas pd, IDictionary <string, NDArray> data, IList <string> index = null) { return(pd.DataFrame <string>(data, index)); }
public static IDataFrame DataFrame(this Pandas pd, NDArray data, IList <string> index, IList <string> columns, Type dtype) { return(pd.DataFrame <string>(data, index, columns, dtype)); }