Skip to content

Commit 5b55f58

Browse files
convert kdocs fixes
1 parent 605d1ac commit 5b55f58

File tree

1 file changed

+39
-23
lines changed
  • core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api

1 file changed

+39
-23
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/convert.kt

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ import kotlin.reflect.typeOf
6060
* Converts the values in the specified [columns\] to a target type
6161
* or using a custom converter, keeping their original names and positions within the [DataFrame].
6262
*
63-
* This function does not immediately convert the columns but instead select columns to convert and
63+
* This function does not immediately convert the columns but instead selects columns to convert and
6464
* returns a [Convert],
6565
* which serves as an intermediate step.
6666
* The [Convert] object allows you to specify how the selected
67-
* columns will be converted using methods such as
67+
* columns will be converted using following methods:
6868
* [to][Convert.to],
6969
* [with][Convert.with],
7070
* [asFrame][Convert.asFrame],
@@ -201,7 +201,7 @@ private interface CommonConvertDocs
201201
* ```kotlin
202202
* df.convert { columnA and columnB }.with { it.toString().lowercase() }
203203
* df.convert { colsOf<String>() }.to<Double>()
204-
* df.convert { colsAtAnyDepth().colGroups() }.asFrame { it.add("nan") { Double.NaN } }
204+
* df.convert { colsAtAnyDepth().colGroups() }.asFrame { it.add("nan") { Double.NaN } }
205205
* ```
206206
* @param [columns\] The [Columns Selector][ColumnsSelector] used to select the columns of this [DataFrame] to group.
207207
*/
@@ -284,7 +284,7 @@ public inline fun <T, C, reified R> Convert<T, C?>.notNull(
284284
/**
285285
* An intermediate class used in the [convert] operation.
286286
*
287-
* This class itself does not perform any conversionit is a transitional step
287+
* This class itself does not perform any conversionit is a transitional step
288288
* before specifying how to convert the selected columns.
289289
* It must be followed by one of the conversion methods
290290
* to produce a new [DataFrame] with updated column values and types.
@@ -371,10 +371,14 @@ public fun <T> Convert<T, *>.to(type: KType): DataFrame<T> = to { it.convertTo(t
371371
* Converts values in the columns previously selected with [convert]
372372
* using [columnConverter] expression within the [DataFrame].
373373
*
374-
* [columnConverter] provides original `DataFrame` as a receiver.
374+
* The [columnConverter] is a lambda with the current [DataFrame] as receiver and the selected column as argument.
375+
* It returns a new [DataColumn] (or [ColumnGroup]) that will replace the original column.
375376
*
376377
* For more information: {@include [DocumentationUrls.Convert]}
377378
*
379+
* ## See Also
380+
* - {@include [SeeAlsoConvertWith]}
381+
*
378382
* ### Examples:
379383
* ```kotlin
380384
* // Select `Int` columns ("valueA", "valueB") and multiply them with `Double` column ("coeff").
@@ -392,17 +396,24 @@ public fun <T, C> Convert<T, C>.to(columnConverter: DataFrame<T>.(DataColumn<C>)
392396
@ExcludeFromSources
393397
private interface SeeAlsoConvertPerRowCol
394398

399+
/** [Convert with][Convert.to] to convert using a column converter */
400+
@ExcludeFromSources
401+
private interface SeeAlsoConvertTo
402+
395403
/**
396404
* Converts values in the columns previously selected with [convert]
397405
* using [row value][RowValueExpression] [expression] within the [DataFrame].
398406
*
399407
* A [row value expression][RowValueExpression] allows to provide a new value for every selected cell
400408
* given its row (as a receiver) and its previous value (as a lambda argument).
409+
*
410+
* For more information: {@include [DocumentationUrls.Convert]}
401411
*
402412
* ## Note
403413
* @include [ExpressionsGivenRow.AddDataRowNote]
404414
* ## See Also
405415
* - {@include [SeeAlsoConvertPerRowCol]}
416+
* - {@include [SeeAlsoConvertTo]}
406417
*
407418
* ### Examples:
408419
* ```kotlin
@@ -427,11 +438,13 @@ public inline fun <T, C, reified R> Convert<T, C>.with(
427438
/**
428439
* Converts [column groups][ColumnGroup] previously selected with [convert]
429440
* as a [DataFrame] using a [dataframe expression][DataFrameExpression].
441+
*
442+
* For more information: {@include [DocumentationUrls.Convert]}
430443
*
431444
* ### Example:
432445
* ```kotlin
433446
* // Add a column to selected column group "name".
434-
* df.convert { name }.asFrame { it.add("fullName") { "$firstName $lastName" } }
447+
* df.convert { name }.asFrame { it.add("fullName") { "\$firstName \$lastName" } }
435448
* ```
436449
*
437450
* @param [expression] The {@include [ExpressionsGivenDataFrame.DataFrameExpressionLink]} to replace the selected column group with.
@@ -450,10 +463,13 @@ private interface SeeAlsoConvertWith
450463
* using [row column][RowColumnExpression] [expression] within the [DataFrame].
451464
*
452465
* A [row column expression][RowColumnExpression] allows to provide a new value for every selected cell
453-
* given its row and column (as a lambda arguments).
466+
* given its row and column (as lambda arguments).
467+
*
468+
* For more information: {@include [DocumentationUrls.Convert]}
454469
*
455470
* ## See Also
456471
* - {@include [SeeAlsoConvertWith]}
472+
* - {@include [SeeAlsoConvertTo]}
457473
*
458474
* ### Example:
459475
* ```kotlin
@@ -788,7 +804,7 @@ public fun <T : Any> DataColumn<T?>.convertToBoolean(): DataColumn<Boolean?> = c
788804
// region convert URL
789805

790806
/**
791-
* Converts values in the [URL] columns previously selected with [convert] to the [IFRAME],
807+
* Converts values in an [URL] columns previously selected with [convert] to an [IFRAME],
792808
* preserving their original names and positions within the [DataFrame].
793809
* Preserves null values.
794810
*
@@ -802,7 +818,7 @@ public fun <T : Any> DataColumn<T?>.convertToBoolean(): DataColumn<Boolean?> = c
802818
* @param border Whether the iframe should have a border. Defaults to `false`.
803819
* @param width Optional width of the iframe in pixels.
804820
* @param height Optional height of the iframe in pixels.
805-
* @return A new [DataFrame] with the values converted to [IFRAME].
821+
* @return A new [DataFrame] with the values converted to an [IFRAME].
806822
*/
807823
@JvmName("toIframeFromUrlNullable")
808824
@Refine
@@ -815,7 +831,7 @@ public fun <T> Convert<T, URL?>.toIFrame(
815831
): DataFrame<T> = to { it.map { url -> url?.let { IFRAME(url.toString(), border, width, height) } } }
816832

817833
/**
818-
* Converts values in the [URL] columns previously selected with [convert] to the [IFRAME],
834+
* Converts values in an [URL] columns previously selected with [convert] to an [IFRAME],
819835
* preserving their original names and positions within the [DataFrame].
820836
*
821837
* For more information: {@include [DocumentationUrls.Convert]}
@@ -828,7 +844,7 @@ public fun <T> Convert<T, URL?>.toIFrame(
828844
* @param border Whether the iframe should have a border. Defaults to `false`.
829845
* @param width Optional width of the iframe in pixels.
830846
* @param height Optional height of the iframe in pixels.
831-
* @return A new [DataFrame] with the values converted to [IFRAME].
847+
* @return A new [DataFrame] with the values converted to an [IFRAME].
832848
*/
833849
@JvmName("toIframeFromUrl")
834850
@Refine
@@ -841,7 +857,7 @@ public fun <T> Convert<T, URL>.toIFrame(
841857
): DataFrame<T> = to { it.map { IFRAME(it.toString(), border, width, height) } }
842858

843859
/**
844-
* Converts values in the [URL] columns previously selected with [convert] to the [IMG],
860+
* Converts values in an [URL] columns previously selected with [convert] to an [IMG],
845861
* preserving their original names and positions within the [DataFrame].
846862
* Preserves null values.
847863
*
@@ -854,7 +870,7 @@ public fun <T> Convert<T, URL>.toIFrame(
854870
*
855871
* @param width Optional width of the image in pixels.
856872
* @param height Optional height of the image in pixels.
857-
* @return A new [DataFrame] with the values converted to [IMG].
873+
* @return A new [DataFrame] with the values converted to an [IMG].
858874
*/
859875
@JvmName("toImgFromUrlNullable")
860876
@Refine
@@ -864,7 +880,7 @@ public fun <T, R : URL?> Convert<T, URL?>.toImg(width: Int? = null, height: Int?
864880
to { it.map { url -> url?.let { IMG(url.toString(), width, height) } } }
865881

866882
/**
867-
* Converts values in the [URL] columns previously selected with [convert] to the [IMG],
883+
* Converts values in an [URL] columns previously selected with [convert] to an [IMG],
868884
* preserving their original names and positions within the [DataFrame].
869885
*
870886
* For more information: {@include [DocumentationUrls.Convert]}
@@ -876,7 +892,7 @@ public fun <T, R : URL?> Convert<T, URL?>.toImg(width: Int? = null, height: Int?
876892
*
877893
* @param width Optional width of the image in pixels.
878894
* @param height Optional height of the image in pixels.
879-
* @return A new [DataFrame] with the values converted to [IMG].
895+
* @return A new [DataFrame] with the values converted to an [IMG].
880896
*/
881897
@JvmName("toImgFromUrl")
882898
@Refine
@@ -890,22 +906,22 @@ public fun <T, R : URL?> Convert<T, URL>.toImg(width: Int? = null, height: Int?
890906
// region toURL
891907

892908
/**
893-
* Converts values in this [String] column to [URL].
909+
* Converts values in this [String] column to an [URL].
894910
*
895-
* @return A new [DataColumn] with the [URL] values.
911+
* @return A new [DataColumn] with an [URL] values.
896912
*/
897913
public fun DataColumn<String>.convertToURL(): DataColumn<URL> = map { URL(it) }
898914

899915
/**
900-
* Converts values in this [String] column to [URL]. Preserves null values.
916+
* Converts values in this [String] column to an [URL]. Preserves null values.
901917
*
902-
* @return A new [DataColumn] with the [URL] nullable values.
918+
* @return A new [DataColumn] with an [URL] nullable values.
903919
*/
904920
@JvmName("convertToURLFromStringNullable")
905921
public fun DataColumn<String?>.convertToURL(): DataColumn<URL?> = map { it?.let { URL(it) } }
906922

907923
/**
908-
* Converts values in the [String] columns previously selected with [convert] to the [URL],
924+
* Converts values in the [String] columns previously selected with [convert] to an [URL],
909925
* preserving their original names and positions within the [DataFrame].
910926
* Preserves null values.
911927
*
@@ -916,7 +932,7 @@ public fun DataColumn<String?>.convertToURL(): DataColumn<URL?> = map { it?.let
916932
* df.convert { webAddress }.toURL()
917933
* ```
918934
*
919-
* @return A new [DataFrame] with the values converted to [URL].
935+
* @return A new [DataFrame] with the values converted to an [URL].
920936
*/
921937
@JvmName("toUrlFromStringNullable")
922938
@Refine
@@ -925,7 +941,7 @@ public fun DataColumn<String?>.convertToURL(): DataColumn<URL?> = map { it?.let
925941
public fun <T> Convert<T, String?>.toURL(): DataFrame<T> = to { it.convertToURL() }
926942

927943
/**
928-
* Converts values in the [String] columns previously selected with [convert] to the [URL],
944+
* Converts values in the [String] columns previously selected with [convert] to an [URL],
929945
* preserving their original names and positions within the [DataFrame].
930946
*
931947
* For more information: {@include [DocumentationUrls.Convert]}
@@ -935,7 +951,7 @@ public fun <T> Convert<T, String?>.toURL(): DataFrame<T> = to { it.convertToURL(
935951
* df.convert { webAddress }.toURL()
936952
* ```
937953
*
938-
* @return A new [DataFrame] with the values converted to [URL].
954+
* @return A new [DataFrame] with the values converted to an [URL].
939955
*/
940956
@JvmName("toUrlFromString")
941957
@Refine

0 commit comments

Comments
 (0)