View Source Chi2fit.CSV (Chi-SquaredFit v2.0.2)

Link to this section Summary

Functions

Reads CSV data, extracts one column, and returns it as a list of NaiveDateTime.

Link to this section Functions

Link to this function

csv_to_list(csvdata, key, options \\ [])

View Source
@spec csv_to_list(
  csvcata :: Enumerable.t(),
  key :: String.t(),
  options :: Keyword.t()
) :: [
  NaiveDateTime.t()
]

Reads CSV data, extracts one column, and returns it as a list of NaiveDateTime.

examples

Examples

iex> csv = ["Done","2019/05/01","2019/06/01"] |> Stream.map(& &1)
...> csv_to_list csv, "Done", header?: true
[~N[2019-06-01 00:00:00], ~N[2019-05-01 00:00:00]]

iex> csv = ["Done","2019/May/01","2019/Jun/01"] |> Stream.map(& &1)
...> csv_to_list csv, "Done", header?: true, format: "{YYYY}/{Mshort}/{0D}"
[~N[2019-06-01 00:00:00], ~N[2019-05-01 00:00:00]]

iex> csv = ["Done","2019/May/01","2019/06/01"] |> Stream.map(& &1)
...> csv_to_list csv, "Done", header?: true, format: "{YYYY}/{Mshort}/{0D}"
[~N[2019-05-01 00:00:00]]

iex> csv = ["Done","2019/May/01","2019/06/01"] |> Stream.map(& &1)
...> csv_to_list csv, "Done", header?: true, format: ["{YYYY}/{Mshort}/{0D}","{YYYY}/{0M}/{0D}"]
[~N[2019-06-01 00:00:00], ~N[2019-05-01 00:00:00]]

iex> csv = ["Done","2019/May/01","2019/Jun/01"] |> Stream.map(& &1)
...> csv_to_list csv, "Done", header?: true, format: ["%Y/%b/%d"], parser: :strftime
[~N[2019-06-01 00:00:00], ~N[2019-05-01 00:00:00]]