0

I'd like to write a function that would be computed on the DataFrame to transform the Index and return a new transformed dataset. (Similar to Views in the SQL world).

As an example, I have some historical stock prices that gets appended daily and want to have a Monthly-view of the data.

I kinda like this solution. But ideally I don't want to keep track of stale data.

Sid
  • 139
  • 1
  • 9
  • I don't think this is a general solution, but in the example you mentioned pandas function [`pd.DataFrame.resample()`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.resample.html) is very helpful. For example, you can do `returns.resample('M').last()` to get the last price of the month for each month. – Peter Wills Jul 13 '17 at 19:17
  • 1
    When you say "view" do you just mean "function"? – juanpa.arrivillaga Jul 13 '17 at 19:27

0 Answers0