How to limit the number of examples in dataset, for testing?
COLLABORATOR
Hi! You can use the `nrows` parameter for this:
```python
data = load_dataset("json", data_files=data_path, nrows=10)
```
2023-04-13T17:40:07Z
https://github.com/huggingface/datasets/issues/5725#issuecomment-1507367172
https://api.github.com/repos/huggingface/datasets/issues/5725
IC_kwDODunzps5Z2JkE
https://api.github.com/repos/huggingface/datasets/issues/comments/1507367172/reactions
2023-04-13T17:40:07Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1507367172
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
NONE
@mariosasko I get:

`TypeError: __init__() got an unexpected keyword argument 'nrows'`
2023-04-13T19:37:30Z
https://github.com/huggingface/datasets/issues/5725#issuecomment-1507513970
https://api.github.com/repos/huggingface/datasets/issues/5725
IC_kwDODunzps5Z2tZy
https://api.github.com/repos/huggingface/datasets/issues/comments/1507513970/reactions
2023-04-13T19:37:30Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1507513970
https://avatars.githubusercontent.com/u/845175?v=4
https://api.github.com/users/ndvbd/events{/privacy}
https://api.github.com/users/ndvbd/followers
https://api.github.com/users/ndvbd/following{/other_user}
https://api.github.com/users/ndvbd/gists{/gist_id}
https://github.com/ndvbd
ndvbd
MDQ6VXNlcjg0NTE3NQ==
https://api.github.com/users/ndvbd/orgs
https://api.github.com/users/ndvbd/received_events
https://api.github.com/users/ndvbd/repos
https://api.github.com/users/ndvbd/starred{/owner}{/repo}
https://api.github.com/users/ndvbd/subscriptions
User
https://api.github.com/users/ndvbd
public
COLLABORATOR
I misread the format in which the dataset is stored -  the `nrows` parameter works for CSV, but not JSON.

This means the only option is first to create a DataFrame and then convert it to a Dataset object:
```python
import pandas as pd
from datasets import Dataset

df = pd.read_json(data_path, lines=True, nrows=10)
ds = Dataset.from_pandas(df)
```
2023-04-20T15:49:40Z
https://github.com/huggingface/datasets/issues/5725#issuecomment-1516566711
https://api.github.com/repos/huggingface/datasets/issues/5725
IC_kwDODunzps5aZPi3
https://api.github.com/repos/huggingface/datasets/issues/comments/1516566711/reactions
2023-04-20T15:49:47Z
https://api.github.com/repos/huggingface/datasets/issues/comments/1516566711
https://avatars.githubusercontent.com/u/47462742?v=4
https://api.github.com/users/mariosasko/events{/privacy}
https://api.github.com/users/mariosasko/followers
https://api.github.com/users/mariosasko/following{/other_user}
https://api.github.com/users/mariosasko/gists{/gist_id}
https://github.com/mariosasko
mariosasko
MDQ6VXNlcjQ3NDYyNzQy
https://api.github.com/users/mariosasko/orgs
https://api.github.com/users/mariosasko/received_events
https://api.github.com/users/mariosasko/repos
https://api.github.com/users/mariosasko/starred{/owner}{/repo}
https://api.github.com/users/mariosasko/subscriptions
User
https://api.github.com/users/mariosasko
public
### Describe the bug

I am using this command:
`data = load_dataset("json", data_files=data_path)`
However, I want to add a parameter, to limit the number of loaded examples to be 10, for development purposes, but can't find this simple parameter.

### Steps to reproduce the bug

In the description.

### Expected behavior

To be able to limit the number of examples

### Environment info

Nothing special