Пример #1
0
def test_read_pandas_csv():
    p = Path("dataframe.csv")
    with pytest.raises(OSError) as e:
        read_pandas(p)

    assert (str(e.value) ==
            "[Errno 2] File b'dataframe.csv' does not exist: b'dataframe.csv'")
Пример #2
0
def test_read_pandas_csv():
    p = Path("dataframe.csv")
    with pytest.raises(OSError) as e:
        read_pandas(p)

    message = str(e.value)
    assert message.startswith("[Errno 2]")
    assert "No such file or directory" in message or "does not exist" in message
Пример #3
0
def test_read_pandas_parquet():
    p = Path("dataframe.parquet")
    with pytest.raises(OSError) as e:
        read_pandas(p)

    assert str(e.value) in [
        # pyarrow
        "Passed non-file path: dataframe.parquet",
        # fastparquet
        "[Errno 2] No such file or directory: 'dataframe.parquet'",
    ]
Пример #4
0
def main(args: Optional[List[Any]] = None) -> None:
    """Run the `pandas_profiling` package.

    Args:
      args: Arguments for the programme (Default value=None).
    """

    # Parse the arguments
    parsed_args = parse_args(args)
    kwargs = vars(parsed_args)

    input_file = Path(kwargs.pop("input_file"))
    output_file = kwargs.pop("output_file")
    if output_file is None:
        output_file = str(input_file.with_suffix(".html"))

    silent = kwargs.pop("silent")

    # read the DataFrame
    df = read_pandas(input_file)

    # Generate the profiling report
    p = ProfileReport(
        df,
        **kwargs,
    )
    p.to_file(Path(output_file), silent=silent)
Пример #5
0
def main(args=None) -> None:
    """ Run the `pandas_profiling` package.

    Args:
      args: Arguments for the programme (Default value=None).
    """

    # Parse the arguments
    args = parse_args(args)
    config.set_args(args, dots=True)

    # read the DataFrame
    df = read_pandas(args.input_file)

    # Generate the profiling report
    p = df.profile_report()
    p.to_file(output_file=args.output_file, silent=args.silent)
Пример #6
0
def main(args=None) -> None:
    """ Run the `pandas_profiling` package.

    Args:
      args: Arguments for the programme (Default value=None).
    """

    # Parse the arguments
    args = parse_args(args)
    config.set_args(args, dots=True)

    # read the DataFrame
    df = read_pandas(args.input_file)

    # Generate the profiling report
    p = df.profile_report()
    p.to_file(output_file=args.output_file)

    # Open a webbrowser tab if requested
    if not args.silent:
        import webbrowser

        webbrowser.open_new_tab(args.output_file)
Пример #7
0
def main(args=None) -> None:
    """Run the `pandas_profiling` package.

    Args:
      args: Arguments for the programme (Default value=None).
    """

    # Parse the arguments
    args = parse_args(args)
    if args.output_file is None:
        args.output_file = str(Path(args.input_file).with_suffix(".html"))
    config.set_args(args, dots=True)

    # read the DataFrame
    df = read_pandas(Path(args.input_file))

    # Generate the profiling report
    p = ProfileReport(
        df,
        minimal=args.minimal,
        explorative=args.explorative,
        config_file=args.config_file,
    )
    p.to_file(Path(args.output_file), silent=args.silent)
Пример #8
0
def test_read_pandas_json():
    p = Path("dataframe.json")
    with pytest.raises(ValueError) as e:
        read_pandas(p)

    assert str(e.value) == "Expected object or value"
Пример #9
0
def test_remove_unsupported_ext():
    with pytest.raises(ValueError):
        read_pandas(Path("dataset.json.tar.gz"))
Пример #10
0
def test_read_pandas_parquet():
    p = Path("dataframe.parquet")
    with pytest.raises(OSError) as e:
        read_pandas(p)

    assert str(e.value) == "Passed non-file path: dataframe.parquet"