ensae_teaching_cs.helpers.enumerate_inspect_source_code (folder, file_pattern = “.*[.]((py)|(ipynb))$”, neg_pattern = “.*(([-]checkpoint)|(_todo)|(_temp)).*”, line_patterns = “from sklearn[_0-9a-zA-Z.]* import ([_a-zA-Z0-9]+);;import sklearn[.]([_a-z]+)”, fullname = False)

Counts groups extracted from source file. We assume all selected files can be opened as text files encoded in utf-8 character set.


ensae_teaching_cs.faq.faq_cython.compile_cython_single_script (script, skip_warn = True, fLOG = <function noLOG at 0x7f3ea9d640d0>)

This function considers a script .pyx, writes the proper setup file, and compiles it.


ensae_teaching_cs.helpers.geo_helper.lambert93_to_WGPS (lambertE, lambertN)

Converts coordinates given in Lambert 93 system, this system is used by IGN and their GEOFLA file format.

ensae_teaching_cs.helpers.video_helper.make_video (images, outvid = None, fps = 5, size = None, is_color = True, format = “XVID”)

Creates a video from a list of images.


ensae_teaching_cs.faq.df_to_clipboard (df, args)

Copies a dataframe as csv text into the clipboard.

ensae_teaching_cs.faq.faq_pandas.groupby_topn (df, by_keys, sort_keys, ascending = True, n = 1, as_index = True)

Takes the top n rows per group.

ensae_teaching_cs.faq.read_csv (filepath_or_buffer, encoding = “utf8”, sep = “ “, args)

Calls function read_csv with different defaults values. If the encoding is utf8 and the data is a file name, the function checks there is no BOM at the beginning. Otherwise, it uses the encoding utf-8-sig.


ensae_teaching_cs.faq.change_legend_location (ax, new_location = “lower center”)

Changes the location of the legend.

ensae_teaching_cs.faq.close_all ()

Closes every graph with matplotlib.

ensae_teaching_cs.faq.graph_with_label (x, y, labels, barplot = True, title = None, figsize = (6, 4), style = None, ax = None, kwargs)

Creates a graph with matplotlib.

ensae_teaching_cs.faq.graph_style (style = “ggplot”)

Changes matplotlib style.

ensae_teaching_cs.helpers.matplotlib_helper_xyz.scatter_xy_id (xy_id, legend = None, ax = None, options)

Creates a scatter plot with a different color for each zone id. The function requires matplotlib.

ensae_teaching_cs.helpers.matplotlib_helper_xyz.scatter_xyz (points, smooth = 0, div = 100, ax = None, options)

Draws a 3D graph (X, Y, Z). The function requires matplotlib and scipy.


ensae_teaching_cs.helpers.image_helper.collate_images (imgs, final = None)

Collates all images horizontally in one image (if not None –> image name).

ensae_teaching_cs.helpers.image_helper.convert_image (imgs, ext, dest = None, fLOG = None)

Converts an image or a list of images into a different format.


ensae_teaching_cs.helpers.size_helper.total_size (o, handlers = None)

Returns the approximate memory footprint an object and all of its contents.


ensae_teaching_cs.helpers.pygame_helper.build_diff_image (pygame, screen, h, maxw, seq1 = None, seq2 = None, diff = None, fonts = None, bars = None, colors = None, progress = None, prev_bars = None)

Builds an image to show a difference between two lists, we assume these list contain distinct items.

ensae_teaching_cs.helpers.pygame_helper.wait_event (pygame)

The function waits for an event, a


ensae_teaching_cs.faq.faq_web.webhtml (url, navigator = “opera”, fLOG = <function noLOG at 0x7f3ea9d640d0>)

Uses the module selenium to retrieve the html content of a website.

ensae_teaching_cs.faq.faq_web.webshot (img, url, navigator = “opera”, add_date = False, size = None, fLOG = <function noLOG at 0x7f3ea9d640d0>)

Uses the module selenium to take a picture of a website. If url and img are lists, the function goes through all the urls and save webshots.