CalcTree Help Pages
  • What is CalcTree?
  • Getting started
    • CalcTree Pages
    • Create a CalcTree Page
    • Add a calculation
    • Collaborate with a colleague
  • Calculations
    • Parameters
      • Math formulas
        • Parameter Data Types
        • Native Functions
          • Arithmetic Functions
          • Trigonometric Functions
          • Logical & Comparison Functions
          • Matrix & Vector Functions
          • Probability & Combinatorics Functions
          • Statistical Functions
          • String Functions
          • Utility Functions
          • Other Native Functions
        • Valid Expression Syntax
      • Supported Units
      • Dropdown List Parameters
        • Linking CSV Data to Dependent Dropdowns in CalcTree
      • Parameter Settings
    • Integrations
      • Python in CalcTree
        • Adding a Python Source
        • Defining Parameters in Python
        • Referencing Other Parameters in Python
        • Working with Units in Python
        • Creating Tables and Visuals in Python
        • Consuming Files in Python
        • Using Pre-installed Python Libraries
      • Spreadsheets [Coming Soon!]
      • File Upload
        • CSV files
      • 3rd Party Software Plugins
        • Excel
        • Grasshopper
        • ETABS [v20 & v21]
        • ETABS [v22]
        • SAP 2000
        • CSI Bridge [v26]
    • Templates [Coming Soon!]
    • Optimising your calculations
  • Pages & Reports
    • CalcTree Documents
    • Static content
    • Parametric content
      • Parametric equation
      • Inputs
      • Outputs
  • Export to PDF
  • API
    • GraphQL API
      • Generating an API key
      • Queries
        • GetCalculation
        • Calculate
      • Examples
        • Bulk calculations with Python
  • Collaborate
    • Add members
    • Review and approval
    • Add stakeholders
  • Administrate
    • CalcTree Workspace
    • Versioning and Audit trail
  • CalcTree for System Administrators
Powered by GitBook
On this page
  • Using CSV files through Python
  • CSV files as calculation sources
  1. Calculations
  2. Integrations
  3. File Upload

CSV files

Upload CSV files as a data source

PreviousFile UploadNext3rd Party Software Plugins

Last updated 5 days ago

CalcTree provides support for using CSV files in your calculation works. There are two ways to use CSV files in your work:

  • Through a script

  • Adding the CSV file as a

Using CSV files through Python

You can upload any file type to a CalcTree page, and the uploaded files will be available to Python scripts.

For example, click on File Upload to select a CSV file from your local drive to upload to CalTree. Use the sample CSV file below. After uploading, the file appears on the right-hand panel, and is accessible to Python via ct.page_files['file_name']. See example below:

import pandas as pd

def read_csv(csv):
    return pd.read_csv(ct.page_files[csv]).astype('object').fillna("")
    
load_patterns_df = read_csv("Load_Pattern_Definitions.csv")

CSV files as calculation sources

Coming soon!

Meanwhile, you can upload any type of file, including CSV files, and use them in Python scripts! To learn more scroll up on this page to #csv-files-through-python

Use a , to then interact with the uploaded file. Here's an example of how you might load the Load_Pattern_Definitions.csv into a pandas dataframe.

CSV parameters are among next items on our roadmap. Please follow our product roadmap items and status and let us know what you think!

Python code source
here
Python
Source
334B
Load_Pattern_Definitions.csv