Python Forum
Finding the price based on industry and number of transactions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Finding the price based on industry and number of transactions
#1
1


I am trying to determine the price for my input table which has the specific industry type and the average monthly transactions based on the reference table 1 which has the price for different industries (these represent the A tier prices) and the reference table 2 which classifies the price tier based on the average monthly transactions..Reference table 1 has the price for pricing tier A for all the industries .. The price for tier B is calculated as 90% of price of Tier A price; the price for tier C is calculated as 90% of price of Tier B price and so on

Input table

| Industry | Avg Monthly Transactions |
| ------------------ | ------------------------ |
| Automotive | 1129 |
| Financial Services | 7219 |
| Retail | 11795 |
| Financial Services | 10092 |
| Retail | 9445 |

Reference table 1

Industry price
Automotive 35
Financial Services 40
Retail 30

Reference table 2


| Pricing Tier |   Minimum Average Monthly Transactions | Maximum Average Monthly Transactions |
| ------------ | -------------------------------------- | ------------------------------------ |
| A | 1 | 100 |
| B | 101 | 1000 |
| C | 1001 | 2500 |
| D | 2501 | 5000 |
| E | 5001 | 10000 |
| F | 10001 | |

Output table

| Industry | Avg Monthly Transactions | Price |
| ------------------ | ------------------------ | ----- |
| Automotive | 1129 | 28.35 |
| Financial Services | 7219 | 26.24 |
| Retail | 11795 | 17.71 |
| Financial Services | 10092 | 23.62 |
| Retail | 9445 | 19.68 |


Python Code Tried

import pandas as pd

df1=pd.read_csv("input.csv")
df2=pd.read_csv("reference1.csv")
df3=pd.read_csv("reference2.csv")

industry =df1[industry]
avgmonthlytransaction=df1[Avg Monthly Transactions]
price=df1.where(df1[avg Monthly Transactions]>=df3[min average] & <=df3[maximum average],pricingtier)
&& df1.where(df1[industry]=df2[Industry],df2[Price]
Reply
#2
You've got a bunch of data on industries, their average monthly transactions, and reference tables with prices and transaction tiers. You want to determine the price for each industry based on its transactions and the industry type.To do this, you first merge your input table with the transaction tier reference table based on the average monthly transactions. Then, you merge this with the reference table containing prices for each industry. After that, you calculate the price for each industry based on its tier (A, B, C, etc.) and the given price tier discounts.Finally, you organize the data into a table with the industry name, average monthly transactions, and the calculated price. That's it! You've got your output table with the prices determined for each industry.
Link Removed
Gribouillis write Jun-04-2024, 07:53 PM:
Clickbait link removed. Please read What to NOT include in a post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Generating accounting transactions data Emekadavid 0 476 Sep-22-2023, 09:00 AM
Last Post: Emekadavid
  class - calculate total price of copies 3lnyn0 1 1,635 Dec-12-2021, 11:43 PM
Last Post: BashBedlam
Exclamation Invalid syntax error(Predict Ethereum Price) lulu43366 2 3,276 Sep-24-2021, 01:24 PM
Last Post: lulu43366
  An important question is how to create a zigzag in price data? epsilon 0 1,347 Nov-18-2020, 08:06 PM
Last Post: epsilon
  Property price calculation oli_action 4 3,288 Jul-15-2020, 04:27 PM
Last Post: sridhar
  Finding MINIMUM number in a random list is not working Mona 5 3,193 Nov-18-2019, 07:27 PM
Last Post: ThomasL
  price + tax rounding mlieqo 11 6,722 Sep-21-2019, 04:53 PM
Last Post: mlieqo
  finding the closest floating point number in a list Skaperen 17 8,681 Sep-19-2019, 10:39 PM
Last Post: Skaperen
  Stock Rate of Change (based on open and current price) Not Working firebird 1 2,447 Jul-29-2019, 07:10 AM
Last Post: perfringo
  Transactions between the list on python juniorcoder 5 3,374 Aug-10-2018, 08:36 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020