Skip to content

Working with pandas#

Open in Colab

pandas is a popular open-source data analysis and manipulation tool.

You can log and visualize pandas DataFrames in the Neptune app.

Custom dashboard displaying metadata logged with pandas

See example in Neptune 

Before you start#

pandas logging example#

  1. Import Neptune and start a run:

    import neptune.new as neptune
    
    run = neptune.init_run()  # (1)!
    
    1. If you haven't set up your credentials, you can log anonymously: neptune.init_run(api_token=neptune.ANONYMOUS_API_TOKEN, project="common/quickstarts")
  2. Create a pandas DataFrame object:

    import pandas as pd
    
    iris_df = pd.read_csv(
        "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv",
        nrows=100,
    )
    
  3. Log the DataFrame to Neptune:

    from neptune.new.types import File
    
    run["data/iris-df"].upload(File.as_html(iris_df))
    
  4. To stop the connection to Neptune and sync all data, call the stop() method:

    run.stop()
    
    Warning

    Always call stop() in interactive environments, such as a Python interpreter or Jupyter notebook. The connection to Neptune is not stopped when the cell has finished executing, but rather when the entire notebook stops.

    If you're running a script, the connection is stopped automatically when the script finishes executing. However, it's a best practice to call stop() when the connection is no longer needed.

  5. To open the run, click the Neptune link in the console output.

    Example link: https://app.neptune.ai/o/common/org/showroom/e/SHOW-102

  6. Explore the figures in the All metadata section.