Writing PyKX data to disk
        pykx.write
    
          QWriter
QWriter(q)
    Write data using q.
splayed
splayed(root, name, table)
    Splays and writes a q table to disk.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
root | 
          
                Union[str, Path, k.SymbolAtom]
           | 
          The path to the root directory of the splayed table.  | 
          required | 
name | 
          
                Union[str, k.SymbolAtom]
           | 
          The name of the table, which will be written to disk.  | 
          required | 
table | 
          
                Union[k.Table, pd.DataFrame]
           | 
          A table-like object to be written as a splayed table.  | 
          required | 
Returns:
| Type | Description | 
|---|---|
                Path
           | 
          The path to the splayed table on disk.  | 
        
See Also
Examples:
Write a pandas DataFrame to disk as a splayed table in the current directory.
df = pd.DataFrame([[x, 2 * x] for x in range(5)])
q.write.splayed('.', 'splayed_table', df)
Write a pykx.Table to disk as a splayed table at /tmp/splayed_table.
table = q('([] a: 10 20 30 40; b: 114 113 98 121)')
q.write.splayed('/tmp', 'splayed_table', table)
    serialized
serialized(path, data)
    Writes a q object to a binary data file using q serialization.
This method is a wrapper around the q function set, and as with any q function, arguments
which are not pykx.K objects are automatically converted into them.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
path | 
          
                Union[str, Path, k.SymbolAtom]
           | 
          The path to write the q object to.  | 
          required | 
data | 
          
                Any
           | 
          An object that will be converted to q, then serialized to disk.  | 
          required | 
Returns:
| Type | Description | 
|---|---|
                Path
           | 
          A   | 
        
See Also
Examples:
Serialize and write a pandas.DataFrame to disk in the current directory.
df = q('([] a: til 5; b: 2 * til 5)').pd()
q.write.serialized('serialized_table', df)
Serialize and write a Python int to disk in the current directory.
q.write.serialized('serialized_int', 145)
    csv
csv(path, table, delimiter=',')
    Writes a given table to a CSV file.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
path | 
          
                Union[str, Path, k.SymbolAtom]
           | 
          The path to the CSV file.  | 
          required | 
delimiter | 
          
                Optional[Union[str, bytes, k.CharAtom]]
           | 
          A single character representing the delimeter between values.  | 
          
                ','
           | 
        
table | 
          
                Union[k.Table, pd.DataFrame]
           | 
          A table like object to be written as a csv file.  | 
          required | 
Returns:
| Type | Description | 
|---|---|
                Path
           | 
          A   | 
        
See Also
Examples:
Write a pandas DataFrame to disk as a csv file in the current directory using a
comma as a seperator between values.
df = q('([] a: til 5; b: 2 * til 5)').pd()
q.write.csv('example.csv', df)
Write a pykx.Table to disk as a csv file in the current directory using a tab as a
seperator between values.
table = q('([] a: 10 20 30 40; b: 114 113 98 121)')
q.write.csv('example.csv', table, '     ')
    json
json(path, data)
    Writes a JSON representation of the given q object to a file.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
path | 
          
                Union[str, Path, k.SymbolAtom]
           | 
          The path to the JSON file.  | 
          required | 
data | 
          
                Any
           | 
          Any type to be serialized and written as a JSON file.  | 
          required | 
Returns:
| Type | Description | 
|---|---|
                Path
           | 
          A   | 
        
See Also
Examples:
Convert a pandas Dataframe to JSON and then write it to disk in the current
directory.
df = q('([] a: til 5; b: 2 * til 5)').pd()
q.write.json('example.json', df)
Convert a Python int to JSON and then write it to disk in the current directory.
q.write.json('example.json', 143)
Convert a Python dictionary to JSON and then write it to disk in the current
directory.
dictionary = {'a': 'hello', 'b':'pykx', 'c':2.71}
q.write.json('example.json', dictionary)