File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -216,10 +216,26 @@ user> (ds/rowvec-at stocks -1)
216216 ((rowvecs ds) idx))
217217
218218
219+ (defn empty-column-names
220+ " Return a sequence of column names whose empty set length matches the row count of the dataset."
221+ [ds]
222+ (let [rc (row-count ds)]
223+ (->> (columns ds)
224+ (lznc/map #(when (== rc (long (dtype/ecount (missing %))))
225+ (:name (meta %))))
226+ (lznc/remove nil?))))
227+
228+
229+ (defn remove-empty-columns
230+ " Remove all columns that have no data - missing set length equals row count."
231+ [ds]
232+ (remove-columns ds (empty-column-names ds)))
233+
234+
219235(export-symbols tech.v3.dataset.io
220- ->dataset
221- ->>dataset
222- write!)
236+ ->dataset
237+ ->>dataset
238+ write!)
223239
224240
225241(defn dataset-parser
You can’t perform that action at this time.
0 commit comments