Skip to content Skip to sidebar Skip to footer

HTML Code To Show Splitted Data_frame In One Html Page Using Python

I am newbie in html/css so and having question about data showing in html format. What i have is a long list which i want to split and show in html format as two separate columns.F

Solution 1:

As your data is managed by a pandas.DataFrame, I would suggest you try to build your table using pandas.

pd.merge(left=df_data[0:4], left_index=True,
         right=df_data[4:8].reset_index(drop=True), right_index=True,
         suffixes=['_left','_right'], how='outer')

   Col1_left Col2_left  Col1_right Col2_right
0          1         a           5          b
1          2         a           6          b
2          3         a           7          b
3          4         a           8          b

Solution 2:

Found solution! When we read data from data_frame, we can firstly trunctate it by desired qty and then we need to remove previous indexing and then we can concat that data:

    pirmas_m = df_data[0:30].reset_index(drop=True)
    antras_m = df_data[30:60].reset_index(drop=True)
    trecias_m = df_data[60:90].reset_index(drop=True)
    ketvirtas_m = df_data[90:120].reset_index(drop=True)
    opa = pd.concat(  [pirmas_m, antras_m, trecias_m, ketvirtas_m], axis=1  )

Post a Comment for "HTML Code To Show Splitted Data_frame In One Html Page Using Python"