Skip to content

Commit 79dee10

Browse files
author
Irene Alvarado
committed
Rename csv example files
1 parent 50e9853 commit 79dee10

File tree

9 files changed

+24
-11
lines changed

9 files changed

+24
-11
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as aq from "https://cdn.skypack.dev/arquero";
22

3-
let t = await aq.fromCSV(await Deno.readTextFile("./examples/flights.csv"));
3+
let t = await aq.fromCSV(await Deno.readTextFile("./examples/csv/flights.csv"));
44

55
t = t
66
.derive({
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Column, DataItem, stringify } from "https://deno.land/std@0.92.0/encoding/csv.ts";
2-
import { readCSV, writeCSV } from '../csv.ts'
1+
import { Column, DataItem, stringify } from 'https://deno.land/std@0.92.0/encoding/csv.ts';
2+
import { readCSV, writeCSV } from 'https://deno.land/x/flat@0.0.2/mod.ts'
33

44
// Path to a csv file
5-
const csvPath = './examples/read-example.csv';
5+
const csvPath = './examples/csv/prices.csv';
66

77
/*
88
Parse a csv file and return a string[][]
@@ -98,7 +98,7 @@ const columns: Column[] = ["name", "age"];
9898

9999
// we have to stringify the data with a row header
100100
const dataString = await stringify(data, columns)
101-
writeCSV('./examples/write-example.csv', dataString)
101+
writeCSV('./examples/csv/names.csv', dataString)
102102

103103
/*
104104
Write one of the previously parsed csv examples
@@ -111,4 +111,4 @@ Three,-0.3,$3000
111111
const data2 = parseColumnCSV as DataItem[]; // have to recast the output
112112
const columns2: Column[] = ["id", "quantity", "cost"];
113113
const dataString2 = await stringify(data2, columns2)
114-
writeCSV('./examples/write-example2.csv', dataString2)
114+
writeCSV('./examples/csv/prices-write.csv', dataString2)

examples/csv/flights2.csv

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
callsign,number,origin,duration,day
2+
ASA607,AS607,KMCF,22350,2021-01-31T00:00:00.000Z
3+
UAL1978,UA1978,KEWR,20778,2021-01-31T00:00:00.000Z
4+
DAL1030,DL1030,KMSP,13982,2021-01-31T00:00:00.000Z
5+
UAL419,UA419,KDEN,8156,2021-01-31T00:00:00.000Z
6+
SKW5736,OO5736,KSLC,6886,2021-01-31T00:00:00.000Z
7+
SKW5805,OO5805,,6196,2021-01-31T00:00:00.000Z
8+
UAL1687,UA1687,KPDX,5306,2021-01-31T00:00:00.000Z
9+
SKW3380,OO3380,KLAS,4361,2021-01-31T00:00:00.000Z
10+
SWA3239,WN3239,KLAX,3128,2021-01-31T00:00:00.000Z

examples/csv/names.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name,age
2+
Rick,70
3+
Smith,14

examples/write-example.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
name,age
2-
Rick,70
3-
Smith,14
1+
name,age
2+
Rick,70
3+
Smith,14

tests/csv-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { assertArrayIncludes } from "https://deno.land/std@0.92.0/testing/asserts.ts"
22
import { readCSV, writeCSV } from '../csv.ts'
33

4-
const csvReadPath = './examples/read-example.csv'
5-
const csvWritePath = './examples/write-example.csv'
4+
const csvReadPath = './examples/csv/prices.csv'
5+
const csvWritePath = './examples/csv/names.csv'
66

77
Deno.test("reads a csv file", async () => {
88
const csv = await readCSV(csvReadPath) as ArrayLike<unknown>

0 commit comments

Comments
 (0)