Python Forum
Converting Pandas DataFrame to a table of hourly blocks
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting Pandas DataFrame to a table of hourly blocks
#1
Photo 
Hello everyone,

I have a data frame that I'd like to visualize as a table (see attached file). Is that possible with pandas? Your help will be very much appreciated.


import pandas as pd
import numpy as np

df = pd.DataFrame({'courseid':['CHEM1250', 'CHEM1250', 'CHEM1250', 'PHYS1200', 'PHYS1200', 'BIOL1150', 'BIOL1150'], \
                   'coursesec':['L01', 'L02', 'L03', 'L01','L02','L01','L01'], \
                   'Day':['Monday','Tuesday','Friday','Tuesday','Thursday','Wednesday','Wednesday'], \
                   'starttime':['8:00', '12:00', '13:00', '9:00', '11:00', '8:00', '13:00'], \
                   'endtime':['9:30', '12:30', '14:00', '10:30','12:00', '9:30', '14:30'], \
                   'instructorid':['John', 'John', 'Bob', 'Jenna', 'Michel', 'Michel', 'Alice']})

print(df)

Attached Files

Thumbnail(s)
   
Reply


Messages In This Thread
Converting Pandas DataFrame to a table of hourly blocks - by Abedin - Apr-24-2025, 12:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Most efficient way to roll through a pandas dataframe? sawtooth500 2 1,299 Aug-28-2024, 10:08 AM
Last Post: Alice12
  docx file to pandas dataframe/excel iitip92 1 3,178 Jun-27-2024, 05:28 AM
Last Post: Pedroski55
  Python Alteryx QS-Passing pandas dataframe column inside SQL query where condition sanky1990 0 1,499 Dec-04-2023, 09:48 PM
Last Post: sanky1990
  RSA Cipher with blocks Paragoon2 0 1,294 Nov-26-2023, 04:35 PM
Last Post: Paragoon2
  Trying to get counts/sum/percentages from pandas similar to pivot table cubangt 6 3,660 Oct-06-2023, 04:32 PM
Last Post: cubangt
  Using pyodbc&pandas to load a Table data to df tester_V 3 3,254 Sep-09-2023, 08:55 PM
Last Post: tester_V
  Question on pandas.dataframe merging two colums shomikc 4 2,135 Jun-29-2023, 11:30 AM
Last Post: snippsat
  Pandas AttributeError: 'DataFrame' object has no attribute 'concat' Sameer33 5 10,875 Feb-17-2023, 06:01 PM
Last Post: Sameer33
  Converting a json file to a dataframe with rows and columns eyavuz21 13 15,366 Jan-29-2023, 03:59 PM
Last Post: eyavuz21
  help how to get size of pandas dataframe into MB\GB mg24 1 5,802 Jan-28-2023, 01:23 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020