1

i have a data frame called abc, that has rows of times (y direction) and columns of dates (x direction), the frame is made up of values.

what i need to do is create a graph by selecting a certain time, this graph needs to be dates vs the values in that row in the the dataframe. attached is a photo of the data

example of dataframe

so i need to be able to create a graph by typing in say 9am and a time series graph will appear of a graph of jun,july,aug,sept etc... on the x axis vs 1,2,6,8,9 etc...on the y

and then it would pull a different graph if i changed it to say 11am

2
  • What is your code thus far? Commented Jul 19, 2016 at 14:46
  • You can write a function to create the graph and then pass it subsets of the DataFrame (Series in this case) using loc. Commented Jul 19, 2016 at 14:48

1 Answer 1

3

This is very basic pandas functionality: You can access the dataframe along the respective axis with the .ix operator

df=pd.DataFrame(np.random.randint(0,10,(5, 4)),index=['9am','10am','11am','12pm','1pm'],columns=['jun','jul','aug','sept'])
# select '9am' and all [:] of the months
df.ix['9am',:].plot()
# select month and 9am  to 11 am
df.ix['9am':'11am','jun'].plot()

plot obviously draws the desired graph.

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.