Comments (4)
Thanks for the issue @simplew2011. We already support loading datasets from hugging face via fsspec's hf://
support (see https://docs.dask.org/en/stable/how-to/connect-to-remote-data.html). For example:
import dask.dataframe as dd
df = dd.read_parquet("hf://datasets/wikimedia/wikipedia/20231101.en")
Can you say more about what you're looking for? It could be things already work
from dask.
-
Currently, only JSONL files are support? loading JSON files is fail
- json
[ {"id": 0, "text": "https://docs.dask.org/en/latest/bag-api.html"}, {"id": 1, "text": "https://docs.dask.org/en/latest/bag-api.html"} ]
- jsonl
{"id": 0, "text": "https://docs.dask.org/en/latest/bag-api.html"} {"id": 1, "text": "https://docs.dask.org/en/latest/bag-api.html"}
import dask.bag as db b_bg = db.read_text('examples/demos/datasets.jsonl').map(json.loads) # ok b_bg1 = db.read_text('examples/demos/datasets.json').map(json.load) # fail
-
I have a usage scenario where I have already used the datasets library to load raw data (such as local JSON and JSONL files). I would like to convert it directly to dask.dataframe in memory instead of converting it to parquet first
from dask.
Currently, only JSONL files are support? loading JSON files is fail
See this related Stackoverflow question and answer https://stackoverflow.com/questions/44889526/dask-bag-jsondecodeerror-when-reading-multiline-json-arrays. In short, the read_text
function interprets every line of your file as a separate element.
I would like to convert it directly to dask.dataframe in memory instead of converting it to parquet first
Maybe you'll be better off just using Dask DataFrame's JSON reader? With data files like this:
data/0.json
:
[
{"id": 0, "text": "https://docs.dask.org/en/latest/bag-api.html"},
{"id": 1, "text": "https://docs.dask.org/en/latest/bag-api.html"}
]
data/1.json
:
[
{"id": 2, "text": "https://docs.dask.org/en/latest/bag-api.html"},
{"id": 3, "text": "https://docs.dask.org/en/latest/bag-api.html"}
]
You can read the data like this:
import dask.dataframe as dd
files = ["data/0.json", "data/1.json"]
df = dd.read_json("data/*.json", lines=False)
print(f"{df.compute() = }")
from dask.
thanks
from dask.
Related Issues (20)
- TypeError: can only concatenate str (not "traceback") to str
- ⚠️ Upstream CI failed ⚠️
- Add support for `pip install dask[jobqueue]` HOT 4
- Mean fails to compute for very large column of pyarrow type HOT 1
- Previously working time series resampling breaks in new version of Dask HOT 3
- When using PyArrow dtypes, aggregations create NaNs of unexpected type HOT 1
- Column with object dtype get converted to string when selecting the column HOT 1
- aggregate function that operates on vector(array of numeric) data
- Dask .head() returns error as .compute returns ok! HOT 2
- API docs missing for `read_csv`, `read_fwf` and `read_table` HOT 3
- New CI failure showing up in fsspec HOT 5
- Overlap with `new_axis` option is not trimmed correctly HOT 1
- ValueError: An error occurred while calling the read_csv method registered to the pandas backend HOT 2
- map_blocks returning pd.DataFrame fails with block_info parameter HOT 4
- Couple of sparse tests are failing HOT 1
- I'm not sure what ’b_dict‘ is, I couldn't find any relevant content HOT 1
- Release GH action needs to be run twice HOT 1
- gpuCI failing due to `pytest` warning HOT 5
- pandas>=2.0.0 incompatibility ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dask.