0

I'm sorry I couldn't come up with a title that fits the details of the post.

I'm trying to make my own Excel sheet for investing stock. And the income statement data sheet looks like below.

**ticker    data_name  data_Month  data_Value**
**Apple**     Revenue      3          $5
**Apple**     Profit       3          $3
**Apple**     Gross_Profit 2          $7
**Google**    Revenue      6          $9
**Google**    Profit       7          $8
.
.
.

I'm trying seperate the sheets based on the data type and organize the data by it's date/time

Monthly Revenue Sheet

ticker/month    **3      4      5      6**  
Apple     $5      $3    $2      $7
Google    $9      $10   $11     $12

Monthly Profit sheet
.
.

I would like to know the easiest to way to get the right result with pandas!

I seperated the data frame by it's data type(ex revenue, profit), but I've lost from organinzing the data as month(row)*value(column).

  • Pivot with data_name/ticker as index and data_Value as columns. If you need separate dataframes as output, use `groupby` and a loop to split. – mozway Aug 21 '23 at 07:11

0 Answers0