Welcome to Pibrary’s documentation!

API Reference

This page contains auto-generated API reference documentation [1].

pibrary

Submodules

pibrary.file
Module Contents
Classes

File

Class to read and write files.

class pibrary.file.File(path: str, *args, **kwargs)[source]

Class to read and write files.

read() File[source]

Sets the io mode to read, and path variable to read from.

Returns: Class object to chain with other methods.

write(obj_file: Any) File[source]

Sets the io mode to write, and path variable to write to.

Parameters:

obj_file – Object to save like dict for j

Returns: Class object to chain with other methods.

json(**kwargs) Optional[Dict[str, List[str]]][source]

Reads or writes json file according to mode set by read/write method.

Parameters:

**kwargs – Keyword arguments for diff read/write like. Eg:nt=4 for json read.

Returns: obj_file if read mode else nothing is returned.

pickle()[source]

Reads or writes pickle file according to mode set by read/write method.

Returns: obj_file if read mode else nothing is returned.

csv(**kwargs) Optional[pandas.DataFrame][source]

Reads or writes csv file according to mode set by read/write method.

Returns: Dataframe if read mode else nothing is returned.

pibrary.logger
Module Contents
Functions

timeit(→ callable)

Calculates the time taken by the function to run.

pibrary.logger.timeit(function: object) callable[source]

Calculates the time taken by the function to run.

Parameters:

function – Object of the function whose running time is to calculated.

Returns: Any object.

pibrary.string
Module Contents
Classes

String

This class is used to preprocess a text.

class pibrary.string.String(seq)[source]

Bases: collections.UserString

This class is used to preprocess a text.

property str: str[source]

Property to get the string of the text.

Returns:

String of the text.

Return type:

str

remove_punctuation_except_period() collections.UserString[source]

Remove punctuation except period from a text.

Returns:

Text without punctuation except period.

Return type:

UserString

remove_punctuation() collections.UserString[source]

Remove punctuation from a text.

Returns:

Text without punctuation.

Return type:

UserString

remove_digits() collections.UserString[source]

This function is used to remove digits from a text.

Returns:

Text without digits.

Return type:

UserString

remove_duplicate_spaces() collections.UserString[source]

Remove duplicate spaces from a text.

Returns:

Text without duplicate spaces.

Return type:

UserString

Indices and tables