Sai

Files and Folders in Python

Folders and Files¶ Let us quickly recap details about folders and files, especially using Linux. You need to be comfortable with the following. Differentiating Files and Folders. Keep in mind that Folders and Directories means the samething. Understanding Absolute or Fully Qualified Path. Understanding Relative Path. Understanding File or Folder permissions. In [1]: # Listing files …

Files and Folders in Python Read More »

Libraries of Map-Reduce Libraries

Limitations of Map Reduce Libraries¶ Here are some of the limitations of using Map Reduce Libraries. We cannot refer attributes with names directly. Functions are scattered and lack consistency. Readability and maintainability are addressed using libraries such as Pandas. Libraries such as PySpark takes care of scalability. {note} We use the approach of loops or …

Libraries of Map-Reduce Libraries Read More »

Revenue Per Order Using Itertools

Revenue per order using itertools¶ Get revenue per order using order_items data set. In [1]: %run 02_preparing_data_sets.ipynb In [2]: order_items[:4] Out[2]: [‘1,1,957,1,299.98,299.98’, ‘2,2,1073,1,199.99,199.99’, ‘3,2,502,5,250.0,50.0’, ‘4,2,403,1,129.99,129.99’] In [3]: order_subtotals = map(lambda oi: (int(oi.split(‘,’)[1]), float(oi.split(‘,’)[4])), order_items) In [4]: list(order_subtotals)[:3] Out[4]: [(1, 299.98), (2, 199.99), (2, 250.0)] In [5]: order_subtotals = map(lambda oi: (int(oi.split(‘,’)[1]), float(oi.split(‘,’)[4])), order_items) order_subtotals_sorted = sorted(order_subtotals) In [6]: order_subtotals_sorted[:3] Out[6]: [(1, …

Revenue Per Order Using Itertools Read More »