Reference Guide¶
Extensions can be managed directly from within the
pd.ext
namespace. This page describes the
functions available.
Repository Management¶
-
class
pandex.ext.
ExtensionRepository
¶ This class allows the user to install and manage extensions that are be accessible from data frames.
Assuming that
pandex
is imported aspd
, then the methods in this class are accessed from the namespace:pd.ext.<method_name>
where
<method_name>
is one of:-
disable_extension
(name)¶ Disable an extension
Input Parameters:
name:
string name of extension (including collection if there is one)
-
enable_extension
(name)¶ Enable an extension
Input Parameters:
name:
string name of extension (including collection if there is one)
-
import_extension
(extension_spec)¶ Imports extensions that don’t already exist into the default repo
Input Parameters:
extension_spec:
A string with one or more lines of format:
extension_location -> name
- where:
extension_location:
location of all the files needed for that extension. There must be a function with the extension name in one of the
.py
files at that location- Format options:
<directory name on local file system>
<.py file name on local file system>
Files on GitHub are referenced:
github:username/repo[@branch/tag][/path/to/directory]
where
repo
is a public repo on github forusername
. The latest commit on master is the default unless a specificbranch
ortag
is optionally provided.
name:
- string name of extension (including collection if required) to be installed
-
reinstall_extension
(name)¶ Re-install an extension from the original source
Input Parameters:
- name:
- string name of extension (including collection if there is one)
-
remove_extension
(name)¶ Permanently remove an extension from the repository
Input Parameters:
name:
string name of extension (including collection if there is one)
-
import
statement¶
An alternative way is provided to install and manage multiple extensions in one go. This is useful, for example, to minimise the number of downloads when extensions are hosted on remote sites like GitHub.
-
class
pandex.ext.
ExtensionImporter
¶ Extensions may also be to be defined in a text file and imported using the standard python
import
statement.The text file must be have a file extension of
.pdext
and be located in the same directory as the file where theimport
is called from.Format of text file:
# Can contain comment lines beginning with # # Blank lines are ignored # one extension specification per line /path/to/extension/files -> extension_function1 /path/to/extension/files -> collection.extension_function2 github:username/repo -> extension_function3
As an example, if a file named
my_extensions
.pdext
is created with the extensions above, then a file namedanalysis.py
can begin:import pandex as pd import my_extensions df = pd.DataFrame({'x': [1,2,3,4]}) # call the extension df.ext.extension_function1()