# How can I approach this problem?

Let's say I have a dataset with pricing information for the same flight during the past year. So, for a flight departing on day D, I have the available price from D-130 up to D (departure day). Then the same for flights on the other 365 days of the year for the same departing time every day. Does this make sense? I want to see if today's price for any departure day in the future is higher or lower than expected, hence if it's expected to rise or not.

Plotting this data on a chart, the X axis are the days prior to departure, and the Y axis the price, I get the following:

How can I shape the data so I can train a model for price prediction? I can't see a clear trend. The price just below 90 means that it's the max price and it's not discounted.

You certainly need to add at least one other variable representing the time of year, because from your graph it's clear that the fare can't be predicted accurately using only the time until departure: for the same day you can have many points representing different fares. That makes sense, since the fares are going to be very different depending if the flight occurs during holiday season or not. There might also be other variables of interest but since it's always the same flight I can't think of any.

I would suggest plotting a graph where x is the time of year and the time before departure is represented for instance with colour or gradient, that should make things clearer.

Yes, you can make a model, but the number of days until departure is only one feature that determines the price. I agree with Erwan that time of the year plays a role. I would say the occupancy rate (how many seats are booked divided by maximum seats) is probably even more important.

If you think about this problem from the perspective of the airline, if they sold more tickets than they normally do, they make the tickets more expensive. Vice versa, if the sold fewer tickets, they make the tickes cheaper.

In your scatter plot, you are probably comparing flights with different occupancy rates. With only a few days to departure, some tickets are close to their max price (ca. 90; probably (almost) all seats booked) and some tickets are much cheaper (ca. 30; probably more seats left than usual).

A very simple model would be:

$$y = \alpha + \beta x$$

Where y = price, x = days to departure, and $$\alpha$$ and $$\beta$$ are parameters.

To make a good model, you need more features.