Azure / Azure/MachineLearningNotebooks

Azure wrongly reads Parquet

Aperta
#1,713 6 commenti 4 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Jupyter Notebook
Stelle
4.4k
Fork
2.6k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Setup**

Python=3.8 + azureml-core=1.36.0 + azureml-dataprep=2.26.0 + pyarrow=7.0.0 + pandas=1.4

**Summary**

`to_pandas_dataframe` **wrongly reads certain Parquet datasets**. Data of some columns appears to be internally shuffled.
This was already [reported but closed without a fix](https://docs.microsoft.com/en-us/answers/questions/119459/parquet-file-registered-in-a-tabluar-format-is-loa.html), due to issues with sharing data publicly.
I share the reproducible example below

**How to reproduce**

```
from azureml.core import Workspace, Dataset
import tempfile
import pandas as pd

# prepare data: list of sha-values with some None values
df = pd.read_csv('error_data.csv')

# configure Azure storage
ws = Workspace.from_config()
dstore = ws.datastores.get('your datastore')
dstore_path = 'relative datastore path'
target = (dstore,dstore_path)

# write to Azure storage
with tempfile.TemporaryDirectory() as tmpdir:
df.to_parquet(f'{tmpdir}/df.parquet')
ds=Dataset.File.upload_directory(tmpdir,target,overwrite=True)

# read by two ways: download and open in pandas or use the Azure connector
with tempfile.TemporaryDirectory() as tmpdir:
ds=Dataset.File.from_files(target)
ds.download(tmpdir)
df1 = pd.read_parquet(tmpdir)
ds = Dataset.Tabular.from_parquet_files(target)
df2 = ds.to_pandas_dataframe()

# comparison fails, the data seems displaced :-(
pd.testing.assert_frame_equal(df1,df2)
```

[error_data.csv](https://github.com/Azure/MachineLearningNotebooks/files/8246099/error_data.csv)

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.