Writing data to a data source
You can write Cognos Analytics data in a notebook using the Python or R programming languages.
You can save or create the data source in My content or Team content.
To write data to the data source, specify the following code in a notebook cell:
- In Python
-
data = CADataConnector.write_data(parameters as described in the following sections)
Parameter | Required or optional | Description |
---|---|---|
data | required |
Pandas.DataFrame. Contains the table of data, which is written to the file. |
path id |
Specify one of path or id |
Path to the data source. If the data source is in My content, specify
.my_folders at the start of the path. If the data source is in Team
content, specify .public_folders at the start of the path. For
example, to specify a file called sales-notebook that is stored in
My content, specify
The ID of the file. For information about how to get the ID of a file, see Finding the ID of a file. For
example:
|
mode | optional |
|
Note: You can use either single or double quotation marks in a method but
not a mix of both.
For examples of how to code the write_data()
method, see Python notebook examples and R notebook examples.