Ravindra Bagale · Data Scienceसर्व coursesया course चे lessonsशोधाEnglish

Data Science · मराठी आवृत्ती

28.6 Blinkit-flavour चुका

By Ravindra Bagale

या course चे सर्व chapters (py + ch)

हे का शिकायचं?

Trailing spaces in IDs, int vs str keys, many-to-many store map, आणि cancelled orders फिल्टर विसरणे.

हे काय आहे?

strip keys, cast types, validate, status filter स्पष्ट.

कसं करायचं?

Step 1. key.str.strip().

Step 2. dtype match.

Step 3. validate.

Step 4. status filter.

उदाहरणं: copy करा आणि चालवा

उदाहरण A — Default how trap.

import pandas as pd
a = pd.DataFrame({"store_id": ["PUN-01", "X"], "amount_inr": [1, 2]})
b = pd.DataFrame({"store_id": ["PUN-01"], "city": ["Pune"]})
print("default", len(a.merge(b, on="store_id")))  # inner -> drops X
print("left", len(a.merge(b, on="store_id", how="left")))

उदाहरण B — City-only key failure.

Two Pune stores merged on city duplicate every Pune order — use store_id.

उदाहरण C — concat reminder.

sep = pd.DataFrame({"order_id": ["A"], "city": ["Pune"]})
oct_ = pd.DataFrame({"order_id": ["B"], "city": ["Nashik"]})
print(pd.concat([sep, oct_], ignore_index=True))  # stack months — not a store join