> For the complete documentation index, see [llms.txt](https://water-strategy.gitbook.io/waterstrategy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://water-strategy.gitbook.io/waterstrategy/tutorials/pywr-scenarios-reading-external-dataframe-and-adding-custom-rules/reading-csv-dataframe.md).

# Reading CSV DataFrame

Go to **New Reservoir Release** node and change **Max Flow** to **-400**, this will allow to flow water through this node

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FD6SGZC2Ngx7QMIeJWhMV%2Fimage.png?alt=media&amp;token=5177bff6-888a-4a4b-91a6-fd5533be1a37" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FVhnARchnbj76OYX2A1zl%2Fimage.png?alt=media&amp;token=fa7d7df0-fb79-4ca7-9938-50ac917e71c6" alt=""><figcaption></figcaption></figure>

The downloaded file, **Thames\_Lee\_Valley\_demand.csv**, contains a time series dataset structured with two key columns:

**timestep:** This column will serve as the index for the time series. It represents the progression of time in the dataset, allowing for chronological organization.

**Lee Valley Demand:** This column contains the data representing demand values in the Lee Valley.&#x20;

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FcezwQQfTvvc8XiDqnn3g%2Fimage.png?alt=media&amp;token=3a19c02f-c28e-40a9-89a9-e4c7dff78e13" alt="" width="443"><figcaption><p><strong>Thames_Lee_Valley_demand</strong></p></figcaption></figure>

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2Fx2iKM79BtgjkuczNHWPf%2Fimage.png?alt=media&amp;token=c87edc18-1e66-4a82-ad1b-b207d346ac05" alt=""><figcaption></figcaption></figure>

Select the output node **Lee Valley Demand** and Edit the **Max Flow**

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FGmcnWojguC3QakYImu3g%2Fimage.png?alt=media&amp;token=11464f27-7479-42c9-86e5-974b56db031f" alt="" width="563"><figcaption></figcaption></figure>

In Options select **PYWR\_PARAMETER**

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FoTlJAXZ60R0BudRC9KTV%2Fimage.png?alt=media&amp;token=9ea98a6b-619e-4003-bfa3-2a9ec53e94fa" alt=""><figcaption></figcaption></figure>

Paste the following configuration:

```json
{
	"type": "DataFrameParameter",
	"url": "Thames_Lee_Valley_demand.csv",
	"column": "Lee Valley Demand",
	"index_col": "timestep",
	"parse_dates": true
}
```

Now it should look as the following image:

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FYG2Q0zzRSJxm2qPE4yjb%2Fimage.png?alt=media&amp;token=f483a92d-743c-4c56-a0d9-2ae7ebd91af9" alt=""><figcaption></figcaption></figure>

### Results

Click on node Lee Valley Demand > Outputs > simulated\_flow to see results of the simulation

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FqWcBZrZfCShX7iNLq16p%2Fimage.png?alt=media&amp;token=d675c232-6569-49d2-806d-beed6b12d7e6" alt="" width="475"><figcaption></figcaption></figure>

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2Ft588Zk8nEzNOkrDDzdij%2Fimage.png?alt=media&amp;token=5c0226cf-f54d-4ae5-aa17-09a3de397c82" alt=""><figcaption><p>simulated_flow (Lee Valley Demand)</p></figcaption></figure>

Now check the **simulated\_volume** for **New reservoir**

<figure><img src="https://2363830371-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODCd8VK2OOl9jOdp5KFf%2Fuploads%2FA0x1yk4RWIezGD2kj1At%2Fimage.png?alt=media&amp;token=152298ee-e777-49f8-bef2-ca9aec8bad9d" alt=""><figcaption><p>simulated volume (New Reservoir)</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://water-strategy.gitbook.io/waterstrategy/tutorials/pywr-scenarios-reading-external-dataframe-and-adding-custom-rules/reading-csv-dataframe.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
