1

I have a csv that consists data of user activity on a particular social media app, the csv contains records of the last 30 days I want to retrieve data of just the first day which I did and stored in a dataframe

The dataframe looks something like

            From                          To               Status
0   2020-08-01 05:16:00     2020-08-01 05:19:05               N
1   2020-08-01 05:19:05     2020-08-01 05:22:10               Y
2   2020-08-01 05:22:10     2020-08-01 05:23:12               N
3   2020-08-01 06:23:12     2020-08-01 06:42:46               Y
4   2020-08-01 06:42:46     2020-08-01 06:45:51               N

The dataframe contains 100 rows

Y stands for Yes, the user was active. N stands for No, the user was not active.

I want the output to look something like this enter image description here

I saw a similar question like this but it couldn't help me in anyway

1 Answer 1

2

For drawing Gantt chart-like graphs, there are plotly and altair. I used the easiest one, 'altair', to draw this. You can draw the graph as it is in the data structure.

import altair as alt

chart = alt.Chart(df).mark_bar().encode(
    x = 'From',
    x2 = 'To',
    y = alt.Y('Status')
)
chart

enter image description here

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.