|
4 | 4 | "cell_type": "markdown", |
5 | 5 | "metadata": { |
6 | 6 | "application/vnd.databricks.v1+cell": { |
7 | | - "cellMetadata": {}, |
| 7 | + "cellMetadata": { |
| 8 | + "byteLimit": 2048000, |
| 9 | + "rowLimit": 10000 |
| 10 | + }, |
8 | 11 | "inputWidgets": {}, |
9 | 12 | "nuid": "4e9d71b1-88e9-445c-820a-b842e217a4e7", |
10 | 13 | "showTitle": false, |
|
21 | 24 | "execution_count": 0, |
22 | 25 | "metadata": { |
23 | 26 | "application/vnd.databricks.v1+cell": { |
24 | | - "cellMetadata": {}, |
| 27 | + "cellMetadata": { |
| 28 | + "byteLimit": 2048000, |
| 29 | + "rowLimit": 10000 |
| 30 | + }, |
25 | 31 | "inputWidgets": {}, |
26 | 32 | "nuid": "e6624c4d-8cb8-4ac4-8c72-81d1b4ecdb57", |
27 | 33 | "showTitle": false, |
|
40 | 46 | "cell_type": "markdown", |
41 | 47 | "metadata": { |
42 | 48 | "application/vnd.databricks.v1+cell": { |
43 | | - "cellMetadata": {}, |
| 49 | + "cellMetadata": { |
| 50 | + "byteLimit": 2048000, |
| 51 | + "rowLimit": 10000 |
| 52 | + }, |
44 | 53 | "inputWidgets": {}, |
45 | 54 | "nuid": "c3788fe5-f4c9-420f-ad72-ec1a39310a2a", |
46 | 55 | "showTitle": false, |
|
97 | 106 | "execution_count": 0, |
98 | 107 | "metadata": { |
99 | 108 | "application/vnd.databricks.v1+cell": { |
100 | | - "cellMetadata": {}, |
| 109 | + "cellMetadata": { |
| 110 | + "byteLimit": 2048000, |
| 111 | + "rowLimit": 10000 |
| 112 | + }, |
101 | 113 | "inputWidgets": {}, |
102 | 114 | "nuid": "137536ea-9bec-4171-8dc2-4bf8b0d771b4", |
103 | 115 | "showTitle": false, |
104 | 116 | "tableResultSettingsMap": {}, |
105 | 117 | "title": "" |
106 | 118 | } |
107 | 119 | }, |
108 | | - "outputs": [], |
| 120 | + "outputs": [ |
| 121 | + { |
| 122 | + "output_type": "stream", |
| 123 | + "name": "stdout", |
| 124 | + "output_type": "stream", |
| 125 | + "text": [ |
| 126 | + "+-------+------------------+----------+\n| id| track_name| artist|\n+-------+------------------+----------+\n| 303651|Heart Won't Forget| Sia|\n|1046089| Shape of you|Ed Sheeran|\n| 33445| I'm the one| DJ Khalid|\n| 811266|Young Dumb & Broke| DJ Khalid|\n| 505727| Happier|Ed Sheeran|\n+-------+------------------+----------+\n\n" |
| 127 | + ] |
| 128 | + } |
| 129 | + ], |
109 | 130 | "source": [ |
110 | 131 | "spotify_data_2669 = [\n", |
111 | 132 | " (303651, \"Heart Won't Forget\", \"Sia\"),\n", |
|
119 | 140 | "spotify_df_2669 = spark.createDataFrame(spotify_data_2669, spotify_columns_2669)\n", |
120 | 141 | "spotify_df_2669.show()" |
121 | 142 | ] |
| 143 | + }, |
| 144 | + { |
| 145 | + "cell_type": "code", |
| 146 | + "execution_count": 0, |
| 147 | + "metadata": { |
| 148 | + "application/vnd.databricks.v1+cell": { |
| 149 | + "cellMetadata": { |
| 150 | + "byteLimit": 2048000, |
| 151 | + "rowLimit": 10000 |
| 152 | + }, |
| 153 | + "inputWidgets": {}, |
| 154 | + "nuid": "d8cfc9be-e847-4e0a-9fd5-7652d74bde8f", |
| 155 | + "showTitle": false, |
| 156 | + "tableResultSettingsMap": {}, |
| 157 | + "title": "" |
| 158 | + } |
| 159 | + }, |
| 160 | + "outputs": [ |
| 161 | + { |
| 162 | + "output_type": "display_data", |
| 163 | + "data": { |
| 164 | + "text/html": [ |
| 165 | + "<style scoped>\n", |
| 166 | + " .table-result-container {\n", |
| 167 | + " max-height: 300px;\n", |
| 168 | + " overflow: auto;\n", |
| 169 | + " }\n", |
| 170 | + " table, th, td {\n", |
| 171 | + " border: 1px solid black;\n", |
| 172 | + " border-collapse: collapse;\n", |
| 173 | + " }\n", |
| 174 | + " th, td {\n", |
| 175 | + " padding: 5px;\n", |
| 176 | + " }\n", |
| 177 | + " th {\n", |
| 178 | + " text-align: left;\n", |
| 179 | + " }\n", |
| 180 | + "</style><div class='table-result-container'><table class='table-result'><thead style='background-color: white'><tr><th>artist</th><th>occurrences</th></tr></thead><tbody><tr><td>DJ Khalid</td><td>2</td></tr><tr><td>Ed Sheeran</td><td>2</td></tr><tr><td>Sia</td><td>1</td></tr></tbody></table></div>" |
| 181 | + ] |
| 182 | + }, |
| 183 | + "metadata": { |
| 184 | + "application/vnd.databricks.v1+output": { |
| 185 | + "addedWidgets": {}, |
| 186 | + "aggData": [], |
| 187 | + "aggError": "", |
| 188 | + "aggOverflow": false, |
| 189 | + "aggSchema": [], |
| 190 | + "aggSeriesLimitReached": false, |
| 191 | + "aggType": "", |
| 192 | + "arguments": {}, |
| 193 | + "columnCustomDisplayInfos": {}, |
| 194 | + "data": [ |
| 195 | + [ |
| 196 | + "DJ Khalid", |
| 197 | + 2 |
| 198 | + ], |
| 199 | + [ |
| 200 | + "Ed Sheeran", |
| 201 | + 2 |
| 202 | + ], |
| 203 | + [ |
| 204 | + "Sia", |
| 205 | + 1 |
| 206 | + ] |
| 207 | + ], |
| 208 | + "datasetInfos": [], |
| 209 | + "dbfsResultPath": null, |
| 210 | + "isJsonSchema": true, |
| 211 | + "metadata": {}, |
| 212 | + "overflow": false, |
| 213 | + "plotOptions": { |
| 214 | + "customPlotOptions": {}, |
| 215 | + "displayType": "table", |
| 216 | + "pivotAggregation": null, |
| 217 | + "pivotColumns": null, |
| 218 | + "xColumns": null, |
| 219 | + "yColumns": null |
| 220 | + }, |
| 221 | + "removedWidgets": [], |
| 222 | + "schema": [ |
| 223 | + { |
| 224 | + "metadata": "{}", |
| 225 | + "name": "artist", |
| 226 | + "type": "\"string\"" |
| 227 | + }, |
| 228 | + { |
| 229 | + "metadata": "{}", |
| 230 | + "name": "occurrences", |
| 231 | + "type": "\"long\"" |
| 232 | + } |
| 233 | + ], |
| 234 | + "type": "table" |
| 235 | + } |
| 236 | + }, |
| 237 | + "output_type": "display_data" |
| 238 | + } |
| 239 | + ], |
| 240 | + "source": [ |
| 241 | + "spotify_df_2669\\\n", |
| 242 | + " .groupBy(\"artist\")\\\n", |
| 243 | + " .agg(count(\"*\").alias(\"occurrences\"))\\\n", |
| 244 | + " .orderBy(col(\"occurrences\").desc(), col(\"artist\").asc()).display()" |
| 245 | + ] |
122 | 246 | } |
123 | 247 | ], |
124 | 248 | "metadata": { |
125 | 249 | "application/vnd.databricks.v1+notebook": { |
126 | | - "computePreferences": null, |
| 250 | + "computePreferences": { |
| 251 | + "hardware": { |
| 252 | + "accelerator": null, |
| 253 | + "gpuPoolId": null, |
| 254 | + "memory": null |
| 255 | + } |
| 256 | + }, |
127 | 257 | "dashboards": [], |
128 | 258 | "environmentMetadata": { |
129 | 259 | "base_environment": "", |
130 | | - "environment_version": "1" |
| 260 | + "environment_version": "2" |
131 | 261 | }, |
132 | 262 | "inputWidgetPreferences": null, |
133 | 263 | "language": "python", |
|
0 commit comments