@@ -1147,6 +1147,69 @@ def preview(
1147
1147
columns_subset=pb.col(pb.starts_with("item") | pb.matches("player"))
1148
1148
)
1149
1149
```
1150
+
1151
+ ### Working with CSV Files
1152
+
1153
+ The `preview()` function can directly accept CSV file paths, making it easy to preview data stored
1154
+ in CSV files without manual loading:
1155
+
1156
+ ```{python}
1157
+ # Get a path to a CSV file from the package data
1158
+ csv_path = pb.get_data_path("global_sales", "csv")
1159
+
1160
+ pb.preview(csv_path)
1161
+ ```
1162
+
1163
+ You can also use a Path object to specify the CSV file:
1164
+
1165
+ ```{python}
1166
+ from pathlib import Path
1167
+
1168
+ csv_file = Path(pb.get_data_path("game_revenue", "csv"))
1169
+
1170
+ pb.preview(csv_file, n_head=3, n_tail=3)
1171
+ ```
1172
+
1173
+ ### Working with Parquet Files
1174
+
1175
+ The `preview()` function can directly accept Parquet files and datasets in various formats:
1176
+
1177
+ ```{python}
1178
+ # Single Parquet file from package data
1179
+ parquet_path = pb.get_data_path("nycflights", "parquet")
1180
+
1181
+ pb.preview(parquet_path)
1182
+ ```
1183
+
1184
+ You can also use glob patterns and directories:
1185
+
1186
+ ```python
1187
+ # Multiple Parquet files with glob patterns
1188
+ pb.preview("data/sales_*.parquet")
1189
+
1190
+ # Directory containing Parquet files
1191
+ pb.preview("parquet_data/")
1192
+
1193
+ # Partitioned Parquet dataset
1194
+ pb.preview("sales_data/") # Auto-discovers partition columns
1195
+ ```
1196
+
1197
+ ### Working with Database Connection Strings
1198
+
1199
+ The `preview()` function supports database connection strings for direct preview of database
1200
+ tables. Connection strings must specify a table using the `::table_name` suffix:
1201
+
1202
+ ```{python}
1203
+ # Get path to a DuckDB database file from package data
1204
+ duckdb_path = pb.get_data_path("game_revenue", "duckdb")
1205
+
1206
+ pb.preview(f"duckdb:///{duckdb_path}::game_revenue")
1207
+ ```
1208
+
1209
+ For comprehensive documentation on supported connection string formats, error handling, and
1210
+ installation requirements, see the [`connect_to_table()`](`pointblank.connect_to_table`)
1211
+ function.
1212
+ ```
1150
1213
"""
1151
1214
1152
1215
# Process input data to handle different data source types
0 commit comments