create a streamlit page, the page's purpose is to display a schedule in a few…
- User
create a streamlit page, the page's purpose is to display a schedule in a few distillable way data for creating schedules is available in a few dataframes this first is focused on silos it looks like this it is accessible via st.session_state[‘plant’].silo_log
timestamp id level grade connected 0 2024-02-22 14:40:19.755653 1 0.00 No Material None 1 2024-02-22 14:40:19.755653 2 58.48 HDF193 None 2 2024-02-22 14:40:19.755653 3 81.19 HDF193 Line C 3 2024-02-22 14:40:19.755653 4 81.13 HDF193 None 4 2024-02-22 14:40:19.755653 5 80.03 HDF193 None 5 2024-02-22 14:40:19.755653 6 89.61 HDF193 Line 5 6 2024-02-22 14:40:19.755653 11 0.00 No Material None 7 2024-02-22 14:40:19.755653 12 0.00 No Material None 8 2024-02-22 14:40:19.755653 13 72.25 GF7660 None 9 2024-02-22 14:40:19.755653 14 0.00 No Material None 10 2024-02-22 14:40:19.755653 15 0.00 No Material None 11 2024-02-22 14:40:19.755653 16 22.31 HD039 None 12 2024-02-22 14:40:19.755653 17 15.51 GF7660 Line 8 13 2024-02-22 14:40:19.755653 18 0.00 No Material None 14 2024-02-22 14:40:19.755653 19 0.00 GE4760 reactor 15 2024-02-22 14:40:19.755653 20 0.00 No Material None 16 2024-02-22 14:40:19.755653 21 0.00 No Material None 17 2024-02-22 14:40:19.755653 22 72.34 HDF193 None 18 2024-02-22 15:10:19.755653 1 0.00 No Material None 19 2024-02-22 15:10:19.755653 2 58.48 HDF193 None 20 2024-02-22 15:10:19.755653 3 79.19 HDF193 Line C 21 2024-02-22 15:10:19.755653 4 81.13 HDF193 None 22 2024-02-22 15:10:19.755653 5 80.03 HDF193 None 23 2024-02-22 15:10:19.755653 6 87.61 HDF193 Line 5 24 2024-02-22 15:10:19.755653 11 0.00 No Material None 25 2024-02-22 15:10:19.755653 12 0.00 No Material None 26 2024-02-22 15:10:19.755653 13 72.25 GF7660 None 27 2024-02-22 15:10:19.755653 14 0.00 No Material None 28 2024-02-22 15:10:19.755653 15 0.00 No Material None 29 2024-02-22 15:10:19.755653 16 22.31 HD039 None 30 2024-02-22 15:10:19.755653 17 13.51 GF7660 Line 8 31 2024-02-22 15:10:19.755653 18 0.00 No Material None 32 2024-02-22 15:10:19.755653 19 8.00 GE4760 reactor 33 2024-02-22 15:10:19.755653 20 0.00 No Material None 34 2024-02-22 15:10:19.755653 21 0.00 No Material None 35 2024-02-22 15:10:19.755653 22 72.34 HDF193 None
Here is the dataframe that is focused on the compounder st.session_state[‘plant’].compounder_log timestamp id silo grade 0 2024-02-22 14:40:19.755653 Line 5 6 HDF193 1 2024-02-22 14:40:19.755653 Line 8 17 GF7660 2 2024-02-22 14:40:19.755653 Line C 3 HDF193 3 2024-02-22 15:10:19.755653 Line 5 6 HDF193 4 2024-02-22 15:10:19.755653 Line 8 17 GF7660 5 2024-02-22 15:10:19.755653 Line C 3 HDF193
Here is the final that is based on the reactor accessible via st.session_state[‘plant’].reactor_log timestamp silo grade 0 2024-02-22 14:40:19.755653 19 GE4760 1 2024-02-22 15:10:19.755653 19 GE4760
Each of these are for a schedule generated 2 cycles long, but schedules may be of an arbitrary length. Create views that help express a schedule from the perspective of the reactor and each of the compounders
- Assistant
- User
create a schedule view that consists of a number of columns, each row represented a silo being completely filled by a reactor, the first column will be the grade that reactor is currently working on, the next will count up from one and increment each time the reactor the completes and moves to the next silo and continues to make the same grade, if the grade chagnes it will reset to 1, the next column will provide the id of the silo that is being filled
- Assistant
- User
the counter should only count when the silo changes and there should only be a new row when the silo changes
- Assistant
- User
write some python code that looks at a dataframe with a column titled 'grade' , it should start at one and count up each time if the value is the same as the last, if it changes then it should reset to 0
- Assistant
Certainly! You can achieve this using Pandas in Python. What you're looking to create is a counter that increments with consecutive identical 'grade' values and resets to 0 every time the value changes. You can use the
shiftfunction to compare each row with the previous one andcumsumto create the count. Here's a small function that takes a pandas DataFrame and performs this operation: - User
TypeError: datetime64 type does not support cumsum operations
- Assistant
- User
TypeError: datetime64 type does not support cumsum operations
- Assistant
The error message
TypeError: datetime64 type does not support cumsum operationsindicates that you are attempting to perform a cumulative sum (cumsum()) operation on a column in a pandas DataFrame that contains datetime64 type data.