module datainc.croix_rouge#

Short summary#

module ensae_projects.datainc.croix_rouge

Data related to La Croix-Rouge (Hackathon Microsoft / ENSAE / Croix-Rouge / 2015)

source on GitHub

Functions#

function

truncated documentation

decrypt_dataframe

Reads an encrypted dataframe.

df2rsthtml

Writes a table into RST or HTML format.

encrypt_file

Encrypts a file with a specific password.

get_meaning

Retrieves data related to the meaning of a table.

get_password_from_keyring_or_env

Gets the password from keyring first, then from the environment variables. …

merge_schema

Merges schemas of various databases.

Documentation#

Data related to La Croix-Rouge (Hackathon Microsoft / ENSAE / Croix-Rouge / 2015)

source on GitHub

ensae_projects.datainc.croix_rouge.decrypt_dataframe(infile, password=None, sep='\t', encoding='utf8', **kwargs)#

Reads an encrypted dataframe.

Parameters:
  • infile – filename

  • password – password

  • sep – separator

  • encoding – encoding

  • kwargs – others options for pandas.read_csv

Returns:

dataframe

source on GitHub

ensae_projects.datainc.croix_rouge.df2rsthtml(df, format='html', fillna='')#

Writes a table into RST or HTML format.

Parameters:
  • df – dataframe

  • format – format

  • fillna – fill empty values

Returns:

string

source on GitHub

ensae_projects.datainc.croix_rouge.encrypt_file(infile, outfile, password=None)#

Encrypts a file with a specific password.

Parameters:
  • password – password for the hackathon, if None, look into os.environ["PWDCROIXROUGE"]

  • infile – input file

  • outfile – output file

Returns:

outfile

source on GitHub

ensae_projects.datainc.croix_rouge.get_meaning(table='invoice', password=None)#

Retrieves data related to the meaning of a table.

Parameters:
Returns:

DataFrame

source on GitHub

ensae_projects.datainc.croix_rouge.get_password_from_keyring_or_env(pwd)#

Gets the password from keyring first, then from the environment variables.

Parameters:

pwd

password to use or None to get it as os.environ["PWDCROIXROUGE"] or from keyring.

Returns:

password

To set the password for keyring:

from pyquickhelper.loghelper import set_password
set_password("HACKATHON2015", "PWDCROIXROUGE", "value")

source on GitHub

ensae_projects.datainc.croix_rouge.merge_schema(tables=None, password=None)#

Merges schemas of various databases.

Parameters:
  • tables – list of tables or None for all

  • password – password

Returns:

dataframe with all columns

source on GitHub