File Formats Flashcards

1
Q

What does CSV stand for?

A

Comma Separated Values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What type of file is plain text with fields separated by commas (,) typically storing data in a tabular format with the same number of fields on each line (row) of the file?

A

CSV

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Since the file suffix .yaml is the official file extension for YAML files, it is the only extension that is valid.

A

False. YML is also valid.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

XML has been a W3C standard since:

A

1998

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

XML’s syntax is very similar to what other format?

A

HTML

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What file type is used by Anaconda for its configuration files?

A

YAML

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The ZIP file format was originally created and implemented by PKWARE via the utility:

A

PKZIP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What file format is often associated with Microsoft Excel and/or Google Spreadsheets?

A

CSV

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What file type can easily be created using Python Dictionaries {key: value, key: value, …

A

JSON

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What file type uses Python-style indention for structure?

A

YAML

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does XML stand for?

A

extensible markup language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does YAML stand for?

A

YAML Ain’t Markup Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

XML is:

A
  • typically design to carry data, not display it like HTML
  • frequently used to save and share structured data, often over the internet
  • designed to be self-descriptive (you define your own tags
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

JSON is:

A
  • language independent, even though it is derived from JS
  • lightweight, text-based format used for data interchange
  • used to transmit data between a server and web apps (think about REST APIs)
  • a popular alternative to XML
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

YAML is:

A
  • a human readable data-serialization language
  • commonly used for configuration files and data storage or transmission
  • supports 3 basic data types:
    • scalars (string, ints, floats)
    • lists
    • associative arrays (maps, dicts, hashes)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

ZIP:

A
  • format commonly used for archives and compression

- was quickly supported by many other utilities, including built-in versions in Windows and Mac OSX

17
Q

To open a TXT file:

A
  • use open()
  • using “with open(…)” will eliminate you from having to close() the file
- Example: 
with open('classic_books.txt') as file:
    reader = csv.reader(file)
for row in reader:
    book_data = "".join(row).split("|")
    classics.append(book_data)
18
Q

How do you display the first or last five records in a DataFrame?

A

df.head() or df.tail()

19
Q

json.load()

A
  • JSON -> python object

- deserializes a fp (.read-supporting text file containing JSON) into a python object

20
Q

json.dumps()

A
  • Python object -> JSON string

- serializes an object as a JSON string

21
Q

json.dump()

A
  • Object -> JSON formatted stream

- serializes an object as a JSON formatted stream (fp - .write-supporting file-like object)

22
Q

How do you read a YAML file?

A
  • use yaml.load()
- Example:
with open('classic_books.yaml') as file:
    classics_dict = yaml.load(file, Loader=yaml.FullLoader)
23
Q

How do you read and parse an XML file?

A
  • ElementTree.parse()

- ET.getroot() gets the root of the tree

24
Q

How do you write a zip file?

A
  • zipfile.ZipFile()
  • Example:
    with zipfile.ZipFile(‘CSC221Lab7.zip’, ‘w’) as outfile:
    for file in files_to_zip:
    outfile.write(file)