pandas-construction-analysis
БесплатноБез исполняемых скриптовНе проверенComprehensive Pandas toolkit for construction data analysis. Filter, group, aggregate BIM elements, calculate quantities, merge datasets, and generate reports…
от datadrivenconstruction★ 461 звезда на GitHubОб этом скилле
Pandas Construction Data Analysis
Overview
Based on DDC methodology (Chapter 2.3), this skill provides comprehensive Pandas operations for construction data processing. Pandas is the Swiss Army knife for data analysts - handling everything from simple data filtering to complex aggregations across millions of rows.
Book Reference: "Pandas DataFrame и LLM ChatGPT" / "Pandas DataFrame and LLM ChatGPT"
"Используя Pandas, вы можете управлять и анализировать наборы данных, намного превосходящие возможности Excel. В то время как Excel способен обрабатывать до 1 миллиона строк данных, Pandas может без труда работать с наборами данных, содержащими десятки миллионов строк." — DDC Book, Chapter 2.3
Quick Start
import pandas as pd
# Read construction data
df = pd.read_excel("bim_export.xlsx")
# Basic operations
print(df.head()) # First 5 rows
print(df.info()) # Column types and memory
print(df.describe()) # Statistics for numeric columns
# Filter structural elements
structural = df[df['Category'] == 'Structural']
# Calculate total volume
total_volume = df['Volume'].sum()
print(f"Total volume: {total_volume:.2f} m³")
DataFrame Fundamentals
Creating DataFrames
import pandas as pd
# From dictionary (construction elements)
elements = pd.DataFrame({
'ElementId': ['E001', 'E002', 'E003', 'E004'],
'Category': ['Wall', 'Floor', 'Wall', 'Column'],
'Material': ['Concrete', 'Concrete', 'Brick', 'Steel'],
'Volume_m3': [45.5, 120.0, 32.0, 8.5],
'Level': ['Level 1', 'Level 1', 'Level 2', 'Level 1']
})
# From CSV
df_csv = pd.read_csv("construction_data.csv")
# From Excel
df_excel = pd.read_excel("project_data.xlsx", sheet_name="Elements")
# From multiple Excel sheets
all_sheets = pd.read_excel("project.xlsx", sheet_name=None) # Dict of DataFrames
Data Types in Construction
# Common data types for construction
df = pd.DataFrame({
'element_id': pd.Series(['W001', 'W002'], dtype='string'),
'quantity': pd.Series([10, 20], dtype='int64'),
'volume': pd.Series([45.5, 32.0], dtype='float64'),
'is_structural': pd.Series([True, False], dtype='bool'),
'created_date': pd.to_datetime(['2024-01-15', '2024-01-16']),
'category': pd.Categorical(['Wall', 'Slab'])
})
# Check data types
print(df.dtypes)
# Convert types
df['quantity'] = df['quantity'].astype('float64')
df['volume'] = pd.to_numeric(df['volume'], errors='coerce')
Filtering and Selection
Basic Filtering
# Single condition
walls = df[df['Category'] == 'Wall']
# Multiple conditions (AND)
large_concrete = df[(df['Material'] == 'Concrete') & (df['Volume_m3'] > 50)]
# Multiple conditions (OR)
walls_or_floors = df[(df['Category'] == 'Wall') | (df['Category'] == 'Floor')]
# Using isin for multiple values
structural = df[df['Category'].isin(['Wall', 'Column', 'Beam', 'Foundation'])]
# String contains
insulated = df[df['Description'].str.contains('insulated', case=False, na=False)]
# Null value filtering
incomplete = df[df['Cost'].isna()]
complete = df[df['Cost'].notna()]
Advanced Selection
# Select columns
volumes = df'ElementId', 'Category', 'Volume_m3'
# Query syntax (SQL-like)
result = df.query("Category == 'Wall' and Volume_m3 > 30")
# Loc and iloc
specific_row = df.loc[0] # By label
range_rows = df.iloc[0:10] # By position
specific_cell = df.loc[0, 'Volume_m3'] # Row and column
subset = df.loc[0:5, ['Category', 'Volume_m3']] # Range with columns
Grouping and Aggregation
GroupBy Operations
# Basic groupby
by_category = df.groupby('Category')['Volume_m3'].sum()
# Multiple aggregations
summary = df.groupby('Category').agg({
'Volume_m3': ['sum', 'mean', 'count'],
'Cost': ['sum', 'mean']
})
# Named aggregations (cleaner output)
summary = df.groupby('Category').agg(
total_volume=('Volume_m3', 'sum'),
avg_volume=('Volume_m3', 'mean'),
element_count=('ElementId', 'count'),
total_cost=('Cost', 'sum')
).reset_index()
# Multiple grouping columns
by_level_cat = df.groupby(['Level', 'Category']).agg({
'Volume_m3': 'sum',
'Cost': 'sum'
}).reset_index()
Pivot Tables
# Create pivot table
pivot = pd.pivot_table(
df,
values='Volume_m3',
index='Level',
columns='Category',
aggfunc='sum',
fill_value=0,
margins=True, # Add totals
margins_name='Total'
)
# Multiple values
pivot_detailed = pd.pivot_table(
df,
values=['Volume_m3', 'Cost'],
index='Level',
columns='Category',
aggfunc={'Volume_m3': 'sum', 'Cost': 'mean'}
)
Data Transformation
Adding Calculated Columns
# Simple calculation
df['Cost_Total'] = df['Volume_m3'] * df['Unit_Price']
# Conditional column
df['Size_Category'] = df['Volume_m3'].apply(
lambda x: 'Large' if x > 50 else ('Medium' if x > 20 else 'Small')
)
# Using np.where for binary co
Установить pandas-construction-analysis в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл pandas-construction-analysis?
Comprehensive Pandas toolkit for construction data analysis. Filter, group, aggregate BIM elements, calculate quantities, merge datasets, and generate reports from structured construction data.
Как установить скилл pandas-construction-analysis?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pandas-construction-analysis запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic