I am importing about 50000 books, along with their prices, in a CSV file. I have uploaded them into pandas with pd.read_excel and filtered the data. The issue that I am having is I am trying to figure out how to solve for the variable x with each book price. To be more specific, if the book has a suggested retail price of $18.99 I then multiply that by the discount that I am receiving by the publisher.
val = [samplefilinv['retail'] * (1- samplefilinv['discount_level'])
0 11.3940
1 9.5936
2 5.1136
3 10.1940
4 7.6736
7 10.7940
So, in the example, above samplefilinv is the dataset containing the retail price of each book along with the discount level. So, if a book has a suggested retail price of $18.99 with a 40% discount it comes out to $11.39 (that is the first row). I then take the fees associated with selling on Amazon, which is 15% + $1.50 for each book and try to calculate the break-even price that I would have to price it at. So, .85x -15.79-1.80 = 0 would be the algebraic equation that I am trying to solve for the first row to come to the break-even price (which is $20.69). This is going to go on for 50000 books. I am trying to figure out how to do this. I have tried putting the dataset into a numpy array, and then from there putting it into a matrix where I could at least try to solve for zero. This hasn't worked and I am not sure how I would convert the information back into a pandas format that I could use.
np.arange('val').reshape((2,3))
In the above "val" is the retail price* discount. I have received the following error message:
TypeError: unsupported operand type(s) for -: 'str' and 'int'