Skip to content

Commit b9bbbd3

Browse files
committed
docs: enhance fill_null documentation with example usage
1 parent 884a2ff commit b9bbbd3

File tree

1 file changed

+11
-1
lines changed
  • datafusion/core/src/dataframe

1 file changed

+11
-1
lines changed

datafusion/core/src/dataframe/mod.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1937,7 +1937,17 @@ impl DataFrame {
19371937
///
19381938
/// # Arguments
19391939
/// * `value` - Value to fill nulls with
1940-
/// * `columns` - List of column names to fill. If empty, fills all columns
1940+
/// * `columns` - List of column names to fill. If empty, fills all columns.
1941+
///
1942+
/// # Example
1943+
/// ```
1944+
/// // Example usage of fill_null:
1945+
/// let df = ctx.read_csv("tests/data/example.csv", CsvReadOptions::new()).await?;
1946+
/// // Fill nulls in only columns "a" and "c":
1947+
/// let df = df.fill_null(ScalarValue::from(0), vec!["a".to_owned(), "c".to_owned()])?;
1948+
/// // Fill nulls across all columns:
1949+
/// let df = df.fill_null(ScalarValue::from(0), vec![])?;
1950+
/// ```
19411951
pub fn fill_null(
19421952
&self,
19431953
value: ScalarValue,

0 commit comments

Comments
 (0)