The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
Error code: DatasetGenerationError
Exception: ArrowInvalid
Message: Failed to parse string: 'UNKNOWN' as a scalar of type double
Traceback: Traceback (most recent call last):
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1848, in _prepare_split_single
writer.write_table(table)
~~~~~~~~~~~~~~~~~~^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 765, in write_table
self._write_table(pa_table, writer_batch_size=writer_batch_size)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 773, in _write_table
pa_table = table_cast(pa_table, self._schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2378, in table_cast
return cast_table_to_schema(table, schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2312, in cast_table_to_schema
cast_array_to_feature(
~~~~~~~~~~~~~~~~~~~~~^
table[name] if name in table_column_names else pa.array([None] * len(table), type=schema.field(name).type),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
feature,
^^^^^^^^
)
^
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 1861, in wrapper
return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2152, in cast_array_to_feature
return array_cast(
array,
...<2 lines>...
allow_decimal_to_str=allow_decimal_to_str,
)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 1863, in wrapper
return func(array, *args, **kwargs)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2015, in array_cast
return array.cast(pa_type)
~~~~~~~~~~^^^^^^^^^
File "pyarrow/array.pxi", line 1161, in pyarrow.lib.Array.cast
File "/usr/local/lib/python3.14/site-packages/pyarrow/compute.py", line 414, in cast
return call_function("cast", [arr], options, memory_pool)
File "pyarrow/_compute.pyx", line 604, in pyarrow._compute.call_function
File "pyarrow/_compute.pyx", line 399, in pyarrow._compute.Function.call
result = GetResultValue(
File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
return check_status(status)
File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
raise convert_status(status)
pyarrow.lib.ArrowInvalid: Failed to parse string: 'UNKNOWN' as a scalar of type double
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1369, in compute_config_parquet_and_info_response
parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
~~~~~~~~~~~~~~~~~~~~~~~~~^
builder, max_dataset_size_bytes=max_dataset_size_bytes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 948, in stream_convert_to_parquet
builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1694, in _prepare_split
for job_id, done, content in self._prepare_split_single(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1880, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
Transaction ID string | Item string | Quantity float64 | Price Per Unit float64 | Total Spent float64 | Payment Method string | Location string | Transaction Date string |
|---|---|---|---|---|---|---|---|
TXN_1961373 | Coffee | 2 | 2 | 4 | Credit Card | Takeaway | 2023-09-08 |
TXN_4977031 | Cake | 4 | 3 | 12 | Cash | In-store | 2023-05-16 |
TXN_4271903 | Cookie | 4 | 1 | 4 | Credit Card | In-store | 2023-07-19 |
TXN_7034554 | Salad | 2 | 5 | 10 | Digital Wallet | Unknown | 2023-04-27 |
TXN_3160411 | Coffee | 2 | 2 | 4 | Digital Wallet | In-store | 2023-06-11 |
TXN_2602893 | Smoothie | 5 | 4 | 20 | Credit Card | Unknown | 2023-03-31 |
TXN_4433211 | Juice | 3 | 3 | 9 | Digital Wallet | Takeaway | 2023-10-06 |
TXN_6699534 | Sandwich | 4 | 4 | 16 | Cash | Unknown | 2023-10-28 |
TXN_4717867 | Juice | 5 | 3 | 15 | Digital Wallet | Takeaway | 2023-07-28 |
TXN_2064365 | Sandwich | 5 | 4 | 20 | Digital Wallet | In-store | 2023-12-31 |
TXN_2548360 | Salad | 5 | 5 | 25 | Cash | Takeaway | 2023-11-07 |
TXN_7619095 | Sandwich | 2 | 4 | 8 | Cash | In-store | 2023-05-03 |
TXN_9437049 | Cookie | 5 | 1 | 5 | Digital Wallet | Takeaway | 2023-06-01 |
TXN_8915701 | Juice | 2 | 1.5 | 3 | Digital Wallet | In-store | 2023-03-21 |
TXN_2847255 | Salad | 3 | 5 | 15 | Credit Card | In-store | 2023-11-15 |
TXN_3765707 | Sandwich | 1 | 4 | 4 | Digital Wallet | Unknown | 2023-06-10 |
TXN_6769710 | Juice | 2 | 3 | 6 | Cash | In-store | 2023-02-24 |
TXN_8876618 | Cake | 5 | 3 | 15 | Cash | Unknown | 2023-03-25 |
TXN_3709394 | Juice | 4 | 3 | 12 | Cash | Takeaway | 2023-01-15 |
TXN_3522028 | Smoothie | 3 | 4 | 12 | Cash | In-store | 2023-04-04 |
TXN_3567645 | Smoothie | 4 | 4 | 16 | Credit Card | Takeaway | 2023-03-30 |
TXN_5132361 | Sandwich | 3 | 4 | 12 | Digital Wallet | Takeaway | 2023-12-01 |
TXN_2616390 | Sandwich | 2 | 4 | 8 | Digital Wallet | Unknown | 2023-09-18 |
TXN_9400181 | Sandwich | 5 | 4 | 20 | Cash | In-store | 2023-06-03 |
TXN_7958992 | Smoothie | 3 | 4 | 12 | Digital Wallet | Unknown | 2023-12-13 |
TXN_5183041 | Cookie | 5 | 1 | 5 | Credit Card | In-store | 2023-04-20 |
TXN_5695074 | Juice | 4 | 3 | 12 | Credit Card | Takeaway | 2023-04-10 |
TXN_8467949 | Smoothie | 5 | 4 | 20 | Credit Card | Unknown | 2023-03-11 |
TXN_1736287 | Juice | 5 | 2 | 10 | Digital Wallet | Unknown | 2023-06-02 |
TXN_8927252 | Juice | 2 | 1 | 2 | Credit Card | Unknown | 2023-11-06 |
TXN_9677376 | Smoothie | 4 | 4 | 16 | Digital Wallet | In-store | 2023-08-15 |
TXN_8853997 | Smoothie | 2 | 4 | 8 | Digital Wallet | Takeaway | 2023-10-09 |
TXN_9130559 | Sandwich | 1 | 4 | 4 | Credit Card | Unknown | 2023-05-28 |
TXN_6855453 | Juice | 4 | 3 | 12 | Digital Wallet | In-store | 2023-07-17 |
TXN_1080432 | Salad | 2 | 5 | 10 | Credit Card | In-store | 2023-04-29 |
TXN_2655815 | Smoothie | 4 | 4 | 16 | Digital Wallet | Takeaway | 2023-06-08 |
TXN_6688524 | Coffee | 4 | 2 | 8 | Digital Wallet | Unknown | 2023-06-29 |
TXN_2083138 | Smoothie | 3 | 4 | 12 | Digital Wallet | In-store | 2023-04-17 |
TXN_2427584 | Sandwich | 4 | 4 | 16 | Digital Wallet | Takeaway | 2023-12-22 |
TXN_6650263 | Tea | 2 | 1.5 | 3 | Digital Wallet | Takeaway | 2023-01-10 |
TXN_9620080 | Juice | 4 | 3 | 12 | Digital Wallet | Takeaway | 2023-10-02 |
TXN_1491578 | Cookie | 2 | 1 | 2 | Digital Wallet | Unknown | 2023-02-23 |
TXN_5455792 | Salad | 3 | 5 | 15 | Cash | Unknown | 2023-03-22 |
TXN_8078640 | Juice | 4 | 3 | 12 | Digital Wallet | In-store | 2023-11-03 |
TXN_9499313 | Juice | 5 | 3 | 15 | Digital Wallet | Unknown | 2023-03-02 |
TXN_8201146 | Juice | 5 | 3 | 15 | Cash | Unknown | 2023-06-26 |
TXN_8230936 | Cake | 3 | 3 | 9 | Digital Wallet | Unknown | 2023-05-02 |
TXN_7742742 | Cake | 5 | 3 | 15 | Digital Wallet | Takeaway | 2023-09-05 |
TXN_6342161 | Salad | 5 | 5 | 25 | Digital Wallet | Takeaway | 2023-01-08 |
TXN_8914892 | Juice | 5 | 5 | 25 | Digital Wallet | Unknown | 2023-03-15 |
TXN_3363746 | Smoothie | 3 | 4 | 12 | Credit Card | Unknown | 2023-11-25 |
TXN_8614868 | Smoothie | 5 | 4 | 20 | Digital Wallet | Takeaway | 2023-12-05 |
TXN_5522862 | Cookie | 3 | 1 | 3 | Credit Card | Takeaway | 2023-03-19 |
TXN_3578141 | Cake | 5 | 3 | 15 | Digital Wallet | Takeaway | 2023-06-27 |
TXN_2080895 | Cake | 3 | 3 | 9 | Digital Wallet | In-store | 2023-04-19 |
TXN_6421134 | Sandwich | 4 | 4 | 16 | Cash | Takeaway | 2023-11-03 |
TXN_8813311 | Juice | 5 | 3 | 15 | Digital Wallet | In-store | 2023-10-07 |
TXN_9023317 | Salad | 1 | 5 | 5 | Digital Wallet | Unknown | 2023-09-30 |
TXN_8051289 | Juice | 1 | 3 | 3 | Digital Wallet | In-store | 2023-10-09 |
TXN_2537617 | Sandwich | 1 | 4 | 4 | Cash | Unknown | 2023-05-27 |
TXN_9099694 | Juice | 3 | 5 | 15 | Digital Wallet | Takeaway | 2023-11-18 |
TXN_9230615 | Smoothie | 4 | 4 | 16 | Digital Wallet | Unknown | 2023-06-01 |
TXN_4987129 | Sandwich | 3 | 3 | 9 | Digital Wallet | In-store | 2023-10-20 |
TXN_8501819 | Juice | 3 | 3 | 9 | Cash | Unknown | 2023-03-30 |
TXN_3068204 | Cookie | 1 | 1 | 1 | Credit Card | Takeaway | 2023-10-03 |
TXN_8427104 | Salad | 2 | 3 | 6 | Digital Wallet | In-store | 2023-10-27 |
TXN_8471743 | Juice | 5 | 3 | 15 | Digital Wallet | In-store | 2023-04-06 |
TXN_2621580 | Tea | 2 | 1.5 | 3 | Cash | In-store | 2023-03-22 |
TXN_4726376 | Cake | 2 | 3 | 6 | Credit Card | In-store | 2023-01-31 |
TXN_6044979 | Juice | 1 | 1 | 1 | Cash | In-store | 2023-12-08 |
TXN_4238417 | Salad | 2 | 5 | 10 | Digital Wallet | Unknown | 2023-06-19 |
TXN_1900620 | Smoothie | 2 | 4 | 8 | Credit Card | Unknown | 2023-12-14 |
TXN_6420335 | Coffee | 1 | 2 | 2 | Cash | Takeaway | 2023-07-16 |
TXN_3858209 | Sandwich | 4 | 4 | 16 | Cash | Unknown | 2023-02-22 |
TXN_8735480 | Tea | 5 | 1.5 | 7.5 | Cash | Unknown | 2023-06-02 |
TXN_3829165 | Juice | 4 | 3 | 12 | Cash | In-store | 2023-06-15 |
TXN_3748616 | Coffee | 2 | 2 | 4 | Credit Card | In-store | 2023-12-09 |
TXN_1993289 | Sandwich | 2 | 4 | 8 | Digital Wallet | In-store | 2023-04-18 |
TXN_2123367 | Cookie | 2 | 1 | 2 | Digital Wallet | Unknown | 2023-11-07 |
TXN_5266394 | Cake | 3 | 3 | 9 | Cash | In-store | 2023-10-28 |
TXN_5107946 | Cake | 4 | 3 | 12 | Credit Card | Unknown | 2023-12-22 |
TXN_8035512 | Tea | 3 | 3 | 9 | Cash | Unknown | 2023-10-29 |
TXN_8718498 | Cake | 5 | 3 | 15 | Credit Card | Unknown | 2023-04-30 |
TXN_3955361 | Cookie | 5 | 1 | 5 | Digital Wallet | Takeaway | 2023-04-02 |
TXN_9487821 | Juice | 1 | 5 | 5 | Digital Wallet | Takeaway | 2023-05-24 |
TXN_4132730 | Juice | 5 | 1 | 5 | Digital Wallet | In-store | 2023-03-12 |
TXN_8976658 | Tea | 2 | 1.5 | 3 | Credit Card | In-store | 2023-08-16 |
TXN_5455936 | Juice | 5 | 3 | 15 | Digital Wallet | In-store | 2023-10-28 |
TXN_2725602 | Juice | 5 | 3 | 15 | Credit Card | Unknown | 2023-09-10 |
TXN_3011323 | Coffee | 3 | 2 | 6 | Credit Card | Unknown | 2023-03-07 |
TXN_6289610 | Juice | 3 | 3 | 9 | Cash | Takeaway | 2023-08-07 |
TXN_8268061 | Salad | 3 | 5 | 15 | Digital Wallet | Takeaway | 2023-08-20 |
TXN_5220895 | Salad | 5 | 5 | 25 | Cash | In-store | 2023-06-10 |
TXN_3085509 | Coffee | 4 | 2 | 8 | Digital Wallet | In-store | 2023-04-15 |
TXN_9999113 | Juice | 4 | 3 | 12 | Cash | Takeaway | 2023-05-27 |
TXN_8779771 | Coffee | 4 | 2 | 8 | Cash | In-store | 2023-07-25 |
TXN_9517146 | Juice | 5 | 5 | 25 | Cash | Takeaway | 2023-10-30 |
TXN_1621920 | Salad | 3 | 5 | 15 | Digital Wallet | Takeaway | 2023-10-28 |
TXN_3808639 | Juice | 2 | 3 | 6 | Digital Wallet | Takeaway | 2023-12-15 |
TXN_6955416 | Salad | 4 | 5 | 20 | Digital Wallet | In-store | 2023-02-25 |
- 📋 Dataset Overview
- 📁 Files
- 🗂️ Column Description
- 🧹 Data Cleaning — What Was Wrong & How It Was Fixed
- 1. Corrupt String Values (
"ERROR"and"UNKNOWN") - 2. Wrong Data Types
- 3. Missing Values in Categorical Columns
- 4. Missing Values in Numeric Columns
- 5. Missing
Total Spent— Derived Column Recovery - 6. Missing & Invalid
Transaction Date - 7.
Total SpentConsistency Recheck - 8. Duplicate Check
- 9. Whitespace in Categorical Columns
- 1. Corrupt String Values (
- ✅ Final Dataset Stats
- 📊 Value Distributions (Cleaned Data)
- 💻 Usage
- 🛠️ Cleaning Notebook
- 📜 License
- 👤 Author
☕ Cafe Sales Dataset (Cleaned)
A cleaned and preprocessed version of a synthetic cafe sales transaction dataset. Originally a dirty, real-world-style dataset riddled with missing values, corrupt entries, and wrong data types — now fully cleaned and ready for analysis or ML tasks.
📋 Dataset Overview
| Property | Value |
|---|---|
| Original Rows | 10,000 |
| Cleaned Rows | 9,540 |
| Columns | 8 |
| Time Period | January 2023 – December 2023 |
| Domain | Retail / Food & Beverage |
📁 Files
| File | Description |
|---|---|
cleaned_cafe_sales.csv |
Final cleaned dataset, ready for use |
dirty_cafe_sales.csv |
Original raw dataset with all issues intact |
cafe_data_cleaning.ipynb |
Full cleaning pipeline notebook (step-by-step) |
🗂️ Column Description
| Column | Type | Description |
|---|---|---|
Transaction ID |
string | Unique identifier for each transaction (e.g., TXN_1961373) |
Item |
string | Menu item purchased (Coffee, Tea, Cake, Cookie, Sandwich, Salad, Juice, Smoothie) |
Quantity |
float | Number of units purchased (1–5) |
Price Per Unit |
float | Price of a single unit in USD (1.0–5.0) |
Total Spent |
float | Total transaction amount = Quantity × Price Per Unit |
Payment Method |
string | Payment type used (Cash, Credit Card, Digital Wallet) |
Location |
string | Where the order was placed (In-store, Takeaway, Unknown) |
Transaction Date |
string | Date of transaction in YYYY-MM-DD format |
🧹 Data Cleaning — What Was Wrong & How It Was Fixed
The raw dataset had several real-world data quality issues. Here's a complete breakdown:
1. Corrupt String Values ("ERROR" and "UNKNOWN")
Problem: Multiple columns contained "ERROR" and "UNKNOWN" strings instead of actual values or proper nulls. These were scattered across Item, Quantity, Price Per Unit, Total Spent, Payment Method, and Location.
Fix: All "ERROR" and "UNKNOWN" strings were replaced with NaN (proper missing values) using df.replace(["ERROR", "UNKNOWN"], np.nan).
Impact after replacement:
| Column | Missing Before Replace | Missing After Replace |
|---|---|---|
| Item | 333 | 969 |
| Quantity | 138 | 479 |
| Price Per Unit | 179 | 533 |
| Total Spent | 173 | 502 |
| Payment Method | 2,579 | 3,178 |
| Location | 3,265 | 3,961 |
| Transaction Date | 159 | 460 |
2. Wrong Data Types
Problem: All numeric columns (Quantity, Price Per Unit, Total Spent) were loaded as object/str dtype because of the corrupt string values mixed in.
Fix: Converted all three to float64 using pd.to_numeric(..., errors='coerce'), which automatically turned any remaining non-numeric values into NaN.
3. Missing Values in Categorical Columns
Problem: Item, Payment Method, and Location had significant missing data (up to ~32–40%).
Fix:
Item→ filled with mode (most frequent value)Payment Method→ filled with mode (most frequent value)Location→ filled with"Unknown"(a distinct, interpretable label rather than imputing a false value, since ~40% was missing — too high to impute reliably)
4. Missing Values in Numeric Columns
Problem: Quantity (479 missing) and Price Per Unit (533 missing) had nulls after type conversion.
Fix: Both filled with their respective medians (both were 3.0), which is robust against skew and the limited range of values (1–5).
5. Missing Total Spent — Derived Column Recovery
Problem: 502 rows had missing Total Spent.
Fix: Since Total Spent = Quantity × Price Per Unit was a deterministic relationship (verified — 0 mismatches existed in rows where all three were present), missing values were recalculated directly: df["Total Spent"] = df["Total Spent"].fillna(df["Quantity"] * df["Price Per Unit"]).
6. Missing & Invalid Transaction Date
Problem: 460 rows had missing or invalid dates (including "ERROR" strings parsed as NaT).
Fix: Parsed the column to datetime64 using pd.to_datetime(..., errors='coerce'), then dropped all rows where the date was null. Dates are a critical anchor for time-series analysis — imputing fake dates would corrupt temporal patterns.
Result: 10,000 → 9,540 rows after dropping 460 undated rows.
7. Total Spent Consistency Recheck
Problem: After all imputations, a final audit revealed 696 rows where Total Spent didn't match Quantity × Price Per Unit (due to median-filled values for Quantity/Price Per Unit changing the expected total).
Fix: Recomputed Total Spent from scratch for all rows: df["Total Spent"] = df["Quantity"] * df["Price Per Unit"]. This guarantees 100% internal consistency.
8. Duplicate Check
Problem: Potential duplicate rows or duplicate Transaction IDs.
Result: ✅ 0 duplicate rows. ✅ 0 duplicate Transaction IDs. No action needed.
9. Whitespace in Categorical Columns
Fix: Applied .str.strip() to Item, Payment Method, and Location to remove any leading/trailing spaces.
✅ Final Dataset Stats
Shape: (9540, 8)
Missing values: 0 in all columns
Duplicate rows: 0
Duplicate Transaction IDs: 0
Total Spent mismatches: 0
Data Types:
Transaction ID str
Item str
Quantity float64
Price Per Unit float64
Total Spent float64
Payment Method str
Location str
Transaction Date str (YYYY-MM-DD)
📊 Value Distributions (Cleaned Data)
Item:
| Item | Count |
|---|---|
| Juice | 2,051 |
| Coffee | 1,123 |
| Salad | 1,099 |
| Cake | 1,082 |
| Sandwich | 1,075 |
| Smoothie | 1,048 |
| Cookie | 1,035 |
| Tea | 1,027 |
Payment Method:
| Method | Count |
|---|---|
| Digital Wallet | 5,212 |
| Credit Card | 2,170 |
| Cash | 2,158 |
Location:
| Location | Count |
|---|---|
| Unknown | 3,779 |
| Takeaway | 2,889 |
| In-store | 2,872 |
Numeric Ranges:
| Column | Min | Max | Mean | Median |
|---|---|---|---|---|
| Quantity | 1.0 | 5.0 | 3.02 | 3.0 |
| Price Per Unit | 1.0 | 5.0 | 2.95 | 3.0 |
| Total Spent | 1.0 | 25.0 | 8.92 | 8.0 |
💻 Usage
import pandas as pd
df = pd.read_csv("cleaned_cafe_sales.csv", parse_dates=["Transaction Date"])
df.head()
🛠️ Cleaning Notebook
The full cleaning process is documented step-by-step in cafe_data_cleaning.ipynb. It covers:
- Initial EDA and dirty data exploration
- Corrupt value detection and replacement
- Type casting and null handling strategies
- Derived column consistency verification
- Final quality audit
📜 License
This dataset is released under the MIT License. Free to use for personal, educational, and commercial purposes.
👤 Author
Aditya Suyal
HuggingFace Profile
- Downloads last month
- 20
