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)
- zipfile.BadZipFile: Overlapped entries (possible zip bomb) HOT 1
- order: not optimal scheduling for patterns where we slice subsets into 2 different datasets and then combine them again HOT 1
- test_tokenize failures in 2024.8.1
- Slicing an array on the last chunk of an axis duplicates the number of chunks HOT 3
- different `run_spec` between consecutive calls to `update_graph` | zarr-formatted xarray
- Appending to partitioned parquet with metadata throws appended dtypes differ even though they should be the same
- when using max/min as first expression for new collumn dataframe will not compute HOT 1
- New "auto" rechunking can break with Zarr
- dask.dataframe can't read_csv HOT 3
- Memory issues with slicing HOT 3
- mode on `axis=1` HOT 4
- "Order of columns does not match" error should give an extra info about expected order HOT 2
- Circular imports in dask-histogram/dask-awkward HOT 6
- Discrepancy in column property with actual structure after grouping
- When adding collumns from 2 dataframes will not compute in some instances, fix for one instance seems to break the other HOT 1
- Are there any workarounds for dask breaking altogether with higher amounts of load than what fits into a worker HOT 2
- Improve error message for boolean index assignment with `nan` shape HOT 1
- Boolean index assignment fails for values of `ndim>1`
- pandas & dask metadata mismatch after .unique()
- Is there any way to have the finalize task be distributed across workers too HOT 1
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.