The show_versions
method contains information on the hosting operating system, pandas version, and versions of other related modules that have been installed.
Note: Refer to What is pandas in Python to learn more about pandas.
show_versions(as_json: Union[str, bool] = False) -> None
The method optionally takes a parameter called as_json
. The default value of the parameter is False
. The possible values the parameter can take are as follows:
as_json
parameter is False
, the method output will be in a human-readable format.as_json
parameter is True
, the method output will be in JSON format.as_json
parameter is a string, then the method considers the passed value as the path to the file where the output will be written in JSON format.import pandasprint("pandas.show_versions(as_json=False) = ")pandas.show_versions(as_json=False)print("\n")print("--" * 8)print("pandas.show_versions(as_json=True) = ")pandas.show_versions(as_json=True)print("\n")print("--" * 8)pandas.show_versions(as_json="output.txt")print("Contents of output.txt")print(open("output.txt").read())
pandas
module.pandas.show_versions()
method with as_json
as False
.pandas.show_versions()
method with as_json
as True
.pandas.show_versions()
method with as_json
as a file path to the file output.txt
. Then print the contents of output.txt
.