Skip to content

Commit 69ab9d4

Browse files
committed
Reformatted the code using black
1 parent 963ddab commit 69ab9d4

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

9-Pandas/2-table-operations.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2973,7 +2973,7 @@
29732973
" \"F\": \"Fail\",\n",
29742974
"}\n",
29752975
"\n",
2976-
"result_card[\"Remarks\"] = result_card['Grade'].map(remarks)\n",
2976+
"result_card[\"Remarks\"] = result_card[\"Grade\"].map(remarks)\n",
29772977
"\n",
29782978
"result_card"
29792979
]

9-Pandas/3-pandas.ipynb

+17-9
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,15 @@
4242
"np.random.seed(0)\n",
4343
"num_records = 100\n",
4444
"\n",
45-
"AIRLINES = ['PIA', 'Qatar Airways', 'Emirates',\"Japan Airways\",\"American Airline\",\"Tata Airline\", \"Saudi Airline\"]\n",
45+
"AIRLINES = [\n",
46+
" \"PIA\",\n",
47+
" \"Qatar Airways\",\n",
48+
" \"Emirates\",\n",
49+
" \"Japan Airways\",\n",
50+
" \"American Airline\",\n",
51+
" \"Tata Airline\",\n",
52+
" \"Saudi Airline\",\n",
53+
"]\n",
4654
"\n",
4755
"CITIES = [\n",
4856
" \"Dubai\",\n",
@@ -64,25 +72,25 @@
6472
"]\n",
6573
"\n",
6674
"flights_data = {\n",
67-
" 'FlightID': np.arange(1, num_records + 1),\n",
68-
" 'Airline': np.random.choice(AIRLINES, num_records),\n",
69-
" 'Destination': np.random.choice(CITIES, num_records),\n",
70-
" 'Duration': np.random.randint(60, 360, num_records), # Duration in minutes\n",
71-
" 'Delay': np.random.randint(0, 120, num_records) # Delay in minutes\n",
75+
" \"FlightID\": np.arange(1, num_records + 1),\n",
76+
" \"Airline\": np.random.choice(AIRLINES, num_records),\n",
77+
" \"Destination\": np.random.choice(CITIES, num_records),\n",
78+
" \"Duration\": np.random.randint(60, 360, num_records), # Duration in minutes\n",
79+
" \"Delay\": np.random.randint(0, 120, num_records), # Delay in minutes\n",
7280
"}\n",
7381
"\n",
7482
"flights_df = pd.DataFrame(flights_data)\n",
75-
"flights_df.to_csv('random_flights_data.csv', index=False)\n",
83+
"flights_df.to_csv(\"random_flights_data.csv\", index=False)\n",
7684
"\n",
7785
"# Read the CSV file using pandas\n",
78-
"flights_df = pd.read_csv('random_flights_data.csv')\n",
86+
"flights_df = pd.read_csv(\"random_flights_data.csv\")\n",
7987
"\n",
8088
"# Display the first few rows of the dataframe\n",
8189
"print(flights_df.head())\n",
8290
"\n",
8391
"# Perform operations on the data\n",
8492
"# Example: Calculate the average duration and delay for each airline\n",
85-
"average_stats = flights_df.groupby('Airline')[['Duration', 'Delay']].mean()\n",
93+
"average_stats = flights_df.groupby(\"Airline\")[[\"Duration\", \"Delay\"]].mean()\n",
8694
"print(average_stats)"
8795
]
8896
}

0 commit comments

Comments
 (0)