core

Some utility functions for working with Pandas.

source

markdown_to_pandas

 markdown_to_pandas (md_table_str:str)

Convert a markdown table string to a pandas DataFrame.

Type Details
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"]
Name Age Occupation
1 Jane 29 Teacher

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.

Type Default Details
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
  Name Age Occupation
0 John 35 Engineer
1 Jane 29 Teacher
2 Bob 42 Doctor
style_obj.data
Name Age Occupation
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
20000000.0

source

convert_to_string

 convert_to_string (val)
string_val = convert_to_string(numeric_val)
string_val
'20.0 M'