2

I am new to time-series programming with Pandas. Here is the sample data:

                     date       2      3      4  ShiftedPrice
0 2017-11-05 09:20:01.134  2123.0  12.23  34.12         300.0
1 2017-11-05 09:20:01.789  2133.0  32.43  45.62         330.0
2 2017-11-05 09:20:02.238  2423.0  35.43  55.62           NaN
3 2017-11-05 09:20:02.567  3423.0  65.43  56.62           NaN
4 2017-11-05 09:20:02.948  2463.0  45.43  58.62           NaN

I would like to plot date vs ShiftedPrice for all pairs where there is no missing values for ShiftedPrice column. You can assume that there will absolutely be no missing values in data column. So please do help me in this.

1 Answer 1

3

You can first remove NaNs rows by dropna:

df = df.dropna(subset=['ShiftedPrice'])

And then plot:

df.plot(x='date', y='ShiftedPrice')

All together:

df.dropna(subset=['ShiftedPrice']).plot(x='date', y='ShiftedPrice')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.