Azure / Azure/MachineLearningNotebooks

Azure wrongly reads Parquet

Offen
#1,713 6 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Jupyter Notebook
Sterne
4.4k
Forks
2.6k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

**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)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginnen Sie mit dem reproduzierbaren Beispiel im Issue und vergleichen Sie den heruntergeladenen pandas DataFrame mit Dataset.Tabular.from_parquet_files(...).to_pandas_dataframe(). Verfolgen Sie den Azure Dataset-Tabular-Parquet-Lesepfad und überprüfen Sie anschließend den Abschluss mit pd.testing.assert_frame_equal(df1, df2) unter Verwendung der bereitgestellten error_data.csv.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
azure, pandas, python
Bereich
cloud, data-engineering
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.