spark-koalas

How to pivot string column using pandas api on spark

How to pivot string column using pandas api on spark Question: I am attempting to convert some code my organization uses from pandas dataframes to pandas api on spark dataframes. We have run into a problem when we try to convert our pivot functions where pandas api on spark does not allow pivot operations on …

Total answers: 1

Check if two dataframes have the same values in the column using .isin in koalas dataframe

Check if two dataframes have the same values in the column using .isin in koalas dataframe Question: I am having a small issue in comparing two dataframes and the dataframes are detailed as below. The dataframes detailed below are all in koalas. import databricks.koalas as ks mini_team_df_1 = ks.DataFrame([‘0000340b’], columns = [‘team_code’]) mini_receipt_df_2 = ks.DataFrame([‘0000340b’], …

Total answers: 2

Use of koalas instead of pandas for numpy where function

Use of koalas instead of pandas for numpy where function Question: I am new to koalas. I have been told to implement koalas instead of pandas in my work. Earlier when we have dataframe we convert that to pandas and use that for np.where with condition check inside. Example in pandas we used to do …

Total answers: 1

How do you import and use Spark-Koalas in palantir-foundry

How do you import and use Spark-Koalas in palantir-foundry Question: How can I — in Palantir-foundry — import and use the "Koalas: pandas API for Apache Spark" open source python package. I know that you can import packages that don’t exist through Code Repo and have done this, can I do this same process for …

Total answers: 2

How to get number of groups in a groupby object in koalas?

How to get number of groups in a groupby object in koalas? Question: How to get number of groups in a groupby object in koalas ? In pandas we can use ngroups, but this method is not implemented yet in koalas. Suppose groupby object is called dfgroup. Any idea ? Asked By: Ousen92i || Source …

Total answers: 2

Databricks Koalas: use for loop to create new columns with conditions and dynamically name the new column based on the old column names

Databricks Koalas: use for loop to create new columns with conditions and dynamically name the new column based on the old column names Question: Example dataset: kdf = ks.DataFrame({“power_1”: [50, 100, 150, 120, 18], “power_2”: [50, 150, 150, 120, 18], “power_3”: [60, 100, 150, 120, 18], “power_4”: [150, 90, 150, 120, 18], “power_30”: [50, 60, …

Total answers: 2

Databricks Koalas Column Assignment Based on Another COlumn Value Lambda Function

Databricks Koalas Column Assignment Based on Another COlumn Value Lambda Function Question: Given a koalas Dataframe: df = ks.DataFrame({“high_risk”: [0, 1, 0, 1, 1], “medium_risk”: [1, 0, 0, 0, 0] }) Running a lambda function to get a new column based on the existing column values: df = df.assign(risk=lambda x: “High” if x.high_risk else (“Medium” …

Total answers: 2