Skip to content

Deprecating DataFrame.read("", delimiter =) #902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import org.jetbrains.kotlinx.dataframe.codeGen.DefaultReadDfMethod
import org.jetbrains.kotlinx.dataframe.impl.ColumnNameGenerator
import org.jetbrains.kotlinx.dataframe.impl.api.Parsers
import org.jetbrains.kotlinx.dataframe.impl.api.parse
import org.jetbrains.kotlinx.dataframe.util.DF_READ_NO_CSV
import org.jetbrains.kotlinx.dataframe.util.DF_READ_NO_CSV_REPLACE
import org.jetbrains.kotlinx.dataframe.values
import java.io.BufferedInputStream
import java.io.BufferedReader
Expand Down Expand Up @@ -100,6 +102,11 @@ public fun DataFrame.Companion.readDelimStr(
readDelim(it, format, colTypes, skipLines, readLines)
}

@Deprecated(
message = DF_READ_NO_CSV,
replaceWith = ReplaceWith(DF_READ_NO_CSV_REPLACE),
level = DeprecationLevel.WARNING,
)
public fun DataFrame.Companion.read(
fileOrUrl: String,
delimiter: Char,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ package org.jetbrains.kotlinx.dataframe.util
* Level.ERROR -> Remove
*/

// region WARNING in 0.14, ERROR in 0.15

private const val MESSAGE_0_15 = "Will be removed in 0.15."

// endregion

// region WARNING in 0.15, ERROR in 0.16

private const val MESSAGE_0_16 = "Will be removed in 0.16."

internal const val DF_READ_NO_CSV = "This function is deprecated and should be replaced with `readCSV`. $MESSAGE_0_16"
internal const val DF_READ_NO_CSV_REPLACE =
"this.readCSV(fileOrUrl, delimiter, header, colTypes, skipLines, readLines, duplicate, charset)"

// endregion

// region WARNING in 0.16, ERROR in 0.17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.jetbrains.kotlinx.dataframe.DataFrame
import org.jetbrains.kotlinx.dataframe.api.take
import org.jetbrains.kotlinx.dataframe.explainer.WritersideFooter
import org.jetbrains.kotlinx.dataframe.explainer.WritersideStyle
import org.jetbrains.kotlinx.dataframe.io.read
import org.jetbrains.kotlinx.dataframe.io.readCSV
import org.jetbrains.kotlinx.dataframe.io.toStandaloneHTML
import org.junit.Test
import java.io.File
Expand All @@ -16,7 +16,7 @@ class OtherSamples {

@Test
fun example() {
val df = DataFrame.read("../data/titanic.csv", delimiter = ';').take(5)
val df = DataFrame.readCSV("../data/titanic.csv", delimiter = ';').take(5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to replace onlhy this call? Did we have something in the docs folder?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in theory "no" because all our docs are generated from runnable code, but I'll check anyway :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha, there was one! Thanks :D

// writeTable(df, "exampleName")
}

Expand Down
Loading