Skip to content

Commit 15c4c80

Browse files
committed
Created using Colaboratory
1 parent 8948e43 commit 15c4c80

File tree

1 file changed

+349
-0
lines changed

1 file changed

+349
-0
lines changed

Diff for: pulsar.ipynb

+349
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,349 @@
1+
{
2+
"nbformat": 4,
3+
"nbformat_minor": 0,
4+
"metadata": {
5+
"colab": {
6+
"provenance": [],
7+
"authorship_tag": "ABX9TyMCs8ZurbYjKgvOK2E6DVNY",
8+
"include_colab_link": true
9+
},
10+
"kernelspec": {
11+
"name": "python3",
12+
"display_name": "Python 3"
13+
},
14+
"language_info": {
15+
"name": "python"
16+
}
17+
},
18+
"cells": [
19+
{
20+
"cell_type": "markdown",
21+
"metadata": {
22+
"id": "view-in-github",
23+
"colab_type": "text"
24+
},
25+
"source": [
26+
"<a href=\"https://colab.research.google.com/github/Sinrez/PythonProjects/blob/main/pulsar.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": null,
32+
"metadata": {
33+
"colab": {
34+
"base_uri": "https://localhost:8080/"
35+
},
36+
"id": "SWq3BNV2eRWO",
37+
"outputId": "4ddf0662-3d33-4149-a4f0-c1571322b6b0"
38+
},
39+
"outputs": [
40+
{
41+
"output_type": "stream",
42+
"name": "stdout",
43+
"text": [
44+
"<class 'pandas.core.frame.DataFrame'>\n",
45+
"RangeIndex: 17898 entries, 0 to 17897\n",
46+
"Data columns (total 9 columns):\n",
47+
" # Column Non-Null Count Dtype \n",
48+
"--- ------ -------------- ----- \n",
49+
" 0 MIP 17898 non-null float64\n",
50+
" 1 STDIP 17898 non-null float64\n",
51+
" 2 EKIP 17898 non-null float64\n",
52+
" 3 SIP 17898 non-null float64\n",
53+
" 4 MC 17898 non-null float64\n",
54+
" 5 STDC 17898 non-null float64\n",
55+
" 6 EKC 17898 non-null float64\n",
56+
" 7 SC 17898 non-null float64\n",
57+
" 8 TG 17898 non-null int64 \n",
58+
"dtypes: float64(8), int64(1)\n",
59+
"memory usage: 1.2 MB\n"
60+
]
61+
}
62+
],
63+
"source": [
64+
"import pandas as pd\n",
65+
"data = pd.read_csv('/content/asset-v1_ITMOUniversity+DATSC+summer_2022_1+type@asset+block@pulsar_stars_new.csv')\n",
66+
"data.info()"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"source": [
72+
"data.head()"
73+
],
74+
"metadata": {
75+
"colab": {
76+
"base_uri": "https://localhost:8080/",
77+
"height": 206
78+
},
79+
"id": "N4xCsN4zh-cu",
80+
"outputId": "a3216c63-41d3-4602-c0ba-ce9641610581"
81+
},
82+
"execution_count": null,
83+
"outputs": [
84+
{
85+
"output_type": "execute_result",
86+
"data": {
87+
"text/plain": [
88+
" MIP STDIP EKIP SIP MC STDC EKC \\\n",
89+
"0 140.562500 55.683782 -0.234571 -0.699648 3.199833 19.110426 7.975532 \n",
90+
"1 102.507812 58.882430 0.465318 -0.515088 1.677258 14.860146 10.576487 \n",
91+
"2 103.015625 39.341649 0.323328 1.051164 3.121237 21.744669 7.735822 \n",
92+
"3 136.750000 57.178449 -0.068415 -0.636238 3.642977 20.959280 6.896499 \n",
93+
"4 88.726562 40.672225 0.600866 1.123492 1.178930 11.468720 14.269573 \n",
94+
"\n",
95+
" SC TG \n",
96+
"0 74.242225 0 \n",
97+
"1 127.393580 0 \n",
98+
"2 63.171909 0 \n",
99+
"3 53.593661 0 \n",
100+
"4 252.567306 0 "
101+
],
102+
"text/html": [
103+
"\n",
104+
" <div id=\"df-f2850226-f07b-42b7-9513-775eb70439ca\">\n",
105+
" <div class=\"colab-df-container\">\n",
106+
" <div>\n",
107+
"<style scoped>\n",
108+
" .dataframe tbody tr th:only-of-type {\n",
109+
" vertical-align: middle;\n",
110+
" }\n",
111+
"\n",
112+
" .dataframe tbody tr th {\n",
113+
" vertical-align: top;\n",
114+
" }\n",
115+
"\n",
116+
" .dataframe thead th {\n",
117+
" text-align: right;\n",
118+
" }\n",
119+
"</style>\n",
120+
"<table border=\"1\" class=\"dataframe\">\n",
121+
" <thead>\n",
122+
" <tr style=\"text-align: right;\">\n",
123+
" <th></th>\n",
124+
" <th>MIP</th>\n",
125+
" <th>STDIP</th>\n",
126+
" <th>EKIP</th>\n",
127+
" <th>SIP</th>\n",
128+
" <th>MC</th>\n",
129+
" <th>STDC</th>\n",
130+
" <th>EKC</th>\n",
131+
" <th>SC</th>\n",
132+
" <th>TG</th>\n",
133+
" </tr>\n",
134+
" </thead>\n",
135+
" <tbody>\n",
136+
" <tr>\n",
137+
" <th>0</th>\n",
138+
" <td>140.562500</td>\n",
139+
" <td>55.683782</td>\n",
140+
" <td>-0.234571</td>\n",
141+
" <td>-0.699648</td>\n",
142+
" <td>3.199833</td>\n",
143+
" <td>19.110426</td>\n",
144+
" <td>7.975532</td>\n",
145+
" <td>74.242225</td>\n",
146+
" <td>0</td>\n",
147+
" </tr>\n",
148+
" <tr>\n",
149+
" <th>1</th>\n",
150+
" <td>102.507812</td>\n",
151+
" <td>58.882430</td>\n",
152+
" <td>0.465318</td>\n",
153+
" <td>-0.515088</td>\n",
154+
" <td>1.677258</td>\n",
155+
" <td>14.860146</td>\n",
156+
" <td>10.576487</td>\n",
157+
" <td>127.393580</td>\n",
158+
" <td>0</td>\n",
159+
" </tr>\n",
160+
" <tr>\n",
161+
" <th>2</th>\n",
162+
" <td>103.015625</td>\n",
163+
" <td>39.341649</td>\n",
164+
" <td>0.323328</td>\n",
165+
" <td>1.051164</td>\n",
166+
" <td>3.121237</td>\n",
167+
" <td>21.744669</td>\n",
168+
" <td>7.735822</td>\n",
169+
" <td>63.171909</td>\n",
170+
" <td>0</td>\n",
171+
" </tr>\n",
172+
" <tr>\n",
173+
" <th>3</th>\n",
174+
" <td>136.750000</td>\n",
175+
" <td>57.178449</td>\n",
176+
" <td>-0.068415</td>\n",
177+
" <td>-0.636238</td>\n",
178+
" <td>3.642977</td>\n",
179+
" <td>20.959280</td>\n",
180+
" <td>6.896499</td>\n",
181+
" <td>53.593661</td>\n",
182+
" <td>0</td>\n",
183+
" </tr>\n",
184+
" <tr>\n",
185+
" <th>4</th>\n",
186+
" <td>88.726562</td>\n",
187+
" <td>40.672225</td>\n",
188+
" <td>0.600866</td>\n",
189+
" <td>1.123492</td>\n",
190+
" <td>1.178930</td>\n",
191+
" <td>11.468720</td>\n",
192+
" <td>14.269573</td>\n",
193+
" <td>252.567306</td>\n",
194+
" <td>0</td>\n",
195+
" </tr>\n",
196+
" </tbody>\n",
197+
"</table>\n",
198+
"</div>\n",
199+
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-f2850226-f07b-42b7-9513-775eb70439ca')\"\n",
200+
" title=\"Convert this dataframe to an interactive table.\"\n",
201+
" style=\"display:none;\">\n",
202+
" \n",
203+
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
204+
" width=\"24px\">\n",
205+
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
206+
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
207+
" </svg>\n",
208+
" </button>\n",
209+
" \n",
210+
" <style>\n",
211+
" .colab-df-container {\n",
212+
" display:flex;\n",
213+
" flex-wrap:wrap;\n",
214+
" gap: 12px;\n",
215+
" }\n",
216+
"\n",
217+
" .colab-df-convert {\n",
218+
" background-color: #E8F0FE;\n",
219+
" border: none;\n",
220+
" border-radius: 50%;\n",
221+
" cursor: pointer;\n",
222+
" display: none;\n",
223+
" fill: #1967D2;\n",
224+
" height: 32px;\n",
225+
" padding: 0 0 0 0;\n",
226+
" width: 32px;\n",
227+
" }\n",
228+
"\n",
229+
" .colab-df-convert:hover {\n",
230+
" background-color: #E2EBFA;\n",
231+
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
232+
" fill: #174EA6;\n",
233+
" }\n",
234+
"\n",
235+
" [theme=dark] .colab-df-convert {\n",
236+
" background-color: #3B4455;\n",
237+
" fill: #D2E3FC;\n",
238+
" }\n",
239+
"\n",
240+
" [theme=dark] .colab-df-convert:hover {\n",
241+
" background-color: #434B5C;\n",
242+
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
243+
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
244+
" fill: #FFFFFF;\n",
245+
" }\n",
246+
" </style>\n",
247+
"\n",
248+
" <script>\n",
249+
" const buttonEl =\n",
250+
" document.querySelector('#df-f2850226-f07b-42b7-9513-775eb70439ca button.colab-df-convert');\n",
251+
" buttonEl.style.display =\n",
252+
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
253+
"\n",
254+
" async function convertToInteractive(key) {\n",
255+
" const element = document.querySelector('#df-f2850226-f07b-42b7-9513-775eb70439ca');\n",
256+
" const dataTable =\n",
257+
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
258+
" [key], {});\n",
259+
" if (!dataTable) return;\n",
260+
"\n",
261+
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
262+
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
263+
" + ' to learn more about interactive tables.';\n",
264+
" element.innerHTML = '';\n",
265+
" dataTable['output_type'] = 'display_data';\n",
266+
" await google.colab.output.renderOutput(dataTable, element);\n",
267+
" const docLink = document.createElement('div');\n",
268+
" docLink.innerHTML = docLinkHtml;\n",
269+
" element.appendChild(docLink);\n",
270+
" }\n",
271+
" </script>\n",
272+
" </div>\n",
273+
" </div>\n",
274+
" "
275+
]
276+
},
277+
"metadata": {},
278+
"execution_count": 5
279+
}
280+
]
281+
},
282+
{
283+
"cell_type": "code",
284+
"source": [
285+
"sample_data = data[((data.TG == 0) & (data.MIP >= 73.4765625) & (data.MIP <= 77.6015625)) | ((data.TG == 1) & (data.MIP >= 25.890625) & (data.MIP <= 31.5078125))]\n",
286+
"sample_data.info()"
287+
],
288+
"metadata": {
289+
"colab": {
290+
"base_uri": "https://localhost:8080/"
291+
},
292+
"id": "RyO1fWR8iB04",
293+
"outputId": "912b06a5-7c9f-44fb-9c7a-f2efd5432582"
294+
},
295+
"execution_count": null,
296+
"outputs": [
297+
{
298+
"output_type": "stream",
299+
"name": "stdout",
300+
"text": [
301+
"<class 'pandas.core.frame.DataFrame'>\n",
302+
"Int64Index: 203 entries, 61 to 17711\n",
303+
"Data columns (total 9 columns):\n",
304+
" # Column Non-Null Count Dtype \n",
305+
"--- ------ -------------- ----- \n",
306+
" 0 MIP 203 non-null float64\n",
307+
" 1 STDIP 203 non-null float64\n",
308+
" 2 EKIP 203 non-null float64\n",
309+
" 3 SIP 203 non-null float64\n",
310+
" 4 MC 203 non-null float64\n",
311+
" 5 STDC 203 non-null float64\n",
312+
" 6 EKC 203 non-null float64\n",
313+
" 7 SC 203 non-null float64\n",
314+
" 8 TG 203 non-null int64 \n",
315+
"dtypes: float64(8), int64(1)\n",
316+
"memory usage: 15.9 KB\n"
317+
]
318+
}
319+
]
320+
},
321+
{
322+
"cell_type": "code",
323+
"source": [
324+
"mean_mip_rounded = round(sample_data['MIP'].mean(), 3)\n",
325+
"mean_mip_rounded"
326+
],
327+
"metadata": {
328+
"colab": {
329+
"base_uri": "https://localhost:8080/"
330+
},
331+
"id": "8goniWKdjnSx",
332+
"outputId": "5534457d-5d7e-4131-cfae-eb3da95bc079"
333+
},
334+
"execution_count": null,
335+
"outputs": [
336+
{
337+
"output_type": "execute_result",
338+
"data": {
339+
"text/plain": [
340+
"52.159"
341+
]
342+
},
343+
"metadata": {},
344+
"execution_count": 12
345+
}
346+
]
347+
}
348+
]
349+
}

0 commit comments

Comments
 (0)