Condividi tramite


Isempty

Controlla se il dataframe è vuoto e restituisce un valore booleano.

Sintassi

isEmpty()

Restituzioni

bool: restituisce True se il dataframe è vuoto, False in caso contrario.

Note

Un dataframe vuoto non contiene righe. Può contenere colonne, ma nessun dato.

Examples

df_empty = spark.createDataFrame([], 'a STRING')
df_empty.isEmpty()
# True

df_non_empty = spark.createDataFrame(["a"], 'STRING')
df_non_empty.isEmpty()
# False

df_nulls = spark.createDataFrame([(None, None)], 'a STRING, b INT')
df_nulls.isEmpty()
# False

df_no_rows = spark.createDataFrame([], 'id INT, value STRING')
df_no_rows.isEmpty()
# True