source
markdown_to_pandas
markdown_to_pandas (md_table_str:str)
Convert a markdown table string to a pandas DataFrame.
md_table_str |
str |
The markdown table string to be converted. |
md_table_str = """
| Name | Age | Occupation |
| ---- | --- | ---------- |
| John | 35 | Engineer |
| Jane | 29 | Teacher |
| Bob | 42 | Doctor |
"""
markdown_df = markdown_to_pandas(md_table_str)
markdown_df[markdown_df.Name == "Jane"]
source
display_df
display_df (df:pandas.core.frame.DataFrame, align:str='left')
Display a pandas DataFrame with specified alignment for the headers and all the cells.
df |
DataFrame |
|
The DataFrame to be displayed. |
align |
str |
left |
Alignment for the headers and all the cells. |
style_obj = display_df(markdown_df)
style_obj
0 |
John |
35 |
Engineer |
1 |
Jane |
29 |
Teacher |
2 |
Bob |
42 |
Doctor |
0 |
John |
35 |
Engineer |
1 |
Jane |
29 |
Teacher |
2 |
Bob |
42 |
Doctor |
source
convert_to_numeric
convert_to_numeric (val)
numeric_val = convert_to_numeric("20 M")
numeric_val
source
convert_to_string
convert_to_string (val)
string_val = convert_to_string(numeric_val)
string_val