Add 'Informatics/InfLab5/' from commit '69ceebd82ec61a27eb6e33aebe6b1a99f3c8425b'
git-subtree-dir: Informatics/InfLab5 git-subtree-mainline:fb818d7ab8git-subtree-split:69ceebd82e
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
import polars
|
||||||
|
from great_tables import style, loc
|
||||||
|
|
||||||
|
table = polars.read_ods("ИнфЛаб5.ods", has_header=False, columns=range(25),
|
||||||
|
drop_empty_rows=False, drop_empty_cols=False)
|
||||||
|
table = table.with_columns(polars.col("column_3").cast(polars.String))
|
||||||
|
for i in range(1, 26):
|
||||||
|
if i == 6: table = table.drop("column_"+str(i))
|
||||||
|
else: table = table.fill_null(" ")
|
||||||
|
polars.Config.set_tbl_rows(100)
|
||||||
|
polars.Config.set_tbl_cols(100)
|
||||||
|
table = table.limit(15)
|
||||||
|
table = table.style
|
||||||
|
for column in range(1, 5):
|
||||||
|
table = table.tab_style(
|
||||||
|
style=style.borders(sides="top", color="#010190", style="solid", weight="3px"),
|
||||||
|
locations=loc.body(columns="column_"+str(column), rows=[3]))
|
||||||
|
table = table.tab_style(
|
||||||
|
style=style.borders(sides="left", color="#010190", style="solid", weight="3px"),
|
||||||
|
locations=loc.body(columns="column_"+str(column), rows=list(range(3, 15))))
|
||||||
|
table = table.tab_style(
|
||||||
|
style=style.borders(sides="bottom", color="#010190", style="solid", weight="3px"),
|
||||||
|
locations=loc.body(columns="column_"+str(column), rows=[14]))
|
||||||
|
for column in [5, 25]:
|
||||||
|
table = table.tab_style(
|
||||||
|
style=style.borders(sides="top", color="#010190", style="solid", weight="3px"),
|
||||||
|
locations=loc.body(columns="column_" + str(column), rows=[3]))
|
||||||
|
table = table.tab_style(
|
||||||
|
style=style.borders(sides="right", color="#010190", style="solid", weight="3px"),
|
||||||
|
locations=loc.body(columns="column_" + str(column), rows=list(range(3, 15))))
|
||||||
|
table = table.tab_style(
|
||||||
|
style=style.borders(sides="bottom", color="#010190", style="solid", weight="3px"),
|
||||||
|
locations=loc.body(columns="column_" + str(column), rows=[14]))
|
||||||
|
for column in range(7, 25):
|
||||||
|
table = table.tab_style(
|
||||||
|
style=style.borders(sides="top", color="#010190", style="solid", weight="3px"),
|
||||||
|
locations=loc.body(columns="column_" + str(column), rows=[3]))
|
||||||
|
table = table.tab_style(
|
||||||
|
style=style.borders(sides="bottom", color="#010190", style="solid", weight="3px"),
|
||||||
|
locations=loc.body(columns="column_" + str(column), rows=[14]))
|
||||||
|
table.show()
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import polars
|
||||||
|
|
||||||
|
|
||||||
|
table = polars.read_ods("ИнфЛаб5.ods", has_header=False, columns=range(25),
|
||||||
|
drop_empty_rows=False, drop_empty_cols=False)
|
||||||
|
table = table.with_columns(polars.col("column_3").cast(polars.String))
|
||||||
|
for i in range(1, 26):
|
||||||
|
if i == 6: table = table.drop("column_"+str(i))
|
||||||
|
else: table = table.fill_null(" ")
|
||||||
|
polars.Config.set_tbl_rows(100)
|
||||||
|
polars.Config.set_tbl_cols(100)
|
||||||
|
# print(table.limit(15))
|
||||||
|
table = table.with_columns(polars.concat_str("column_4", "column_5"))
|
||||||
|
table = table.drop("column_5")
|
||||||
|
for i in range(7, 25):
|
||||||
|
table = table.with_columns(polars.concat_str("column_7", "column_"+str(i+1)))
|
||||||
|
table = table.drop("column_"+str(i+1))
|
||||||
|
print(table.limit(15))
|
||||||
Reference in New Issue
Block a user