Untitled

 avatar
unknown
plain_text
6 months ago
1.1 kB
3
Indexable
Working Gibbs
```
import pandas as pd
from wqchartpy import gibbs

# Load the Excel file
file_path = 'file.xlsx'  # Update with your actual file path
sheet_name = 'GIBBS'

# Read the data from the specified sheet
df = pd.read_excel(file_path, sheet_name=sheet_name)

# Ensure 'Marker' column exists, if not create it with default value 'o'
if 'Marker' not in df.columns:
    df['Marker'] = 'o'  # Default marker style

# Ensure 'Size' column exists, if not create it with default value 50
if 'Size' not in df.columns:
    df['Size'] = 50  # Default marker size

# Ensure the 'Color' column exists. If not, create it with a default value.
if 'Color' not in df.columns:
    df['Color'] = 'blue'  # Example default color - choose your desired color

# Ensure the 'Alpha' column exists. If not, create it with a default value.
if 'Alpha' not in df.columns:
    df['Alpha'] = 1.0  # Default alpha value for full opacity

# Ensure the necessary columns are numeric (e.g., TDS, Na/Cl ratio, etc.)
df = df.apply(pd.to_numeric, errors='ignore')

# Plot the Gibbs diagram
gibbs.plot(df)


```
Editor is loading...
Leave a Comment