Sign In
Not register? Register Now!
Pages:
5 pages/≈1375 words
Sources:
No Sources
Level:
Other
Subject:
IT & Computer Science
Type:
Other (Not Listed)
Language:
English (U.S.)
Document:
MS Word
Date:
Total cost:
$ 27
Topic:

Data Analysis (Other (Not Listed) Sample)

Instructions:
Question 1.1.2. Make an array containing the five strings "Hello" , "," , " " , "world" , and "!" . (The third one is a single space inside quotes.) Name it hello_world_components . Note: If you evaluate hello_world_components , you'll notice some extra information in addition to its contents: dtype='<U5' . That's just NumPy's extremely cryptic way of saying that the data types in the array are strings. Question 1.1.3. Import numpy as np and then use np.arange to create an array with the multiples of 99 from 0 up to (and including) 9999. (So its elements are 0, 99, 198, 297, etc.) Question 1.1.4. Create an array of the time, in seconds, since the start of the month at which each hourly reading was taken. Name it collection_times . Hint 1: There were 31 days in December, which is equivalent to (31 × 24) hours or ( 31 × 24 × 60 × 60) seconds. So your array should have 31 × 24 elements in it. Hint 2: The len function works on arrays, too! If your collection_times isn't passing the tests, check its length and make sure it has 31 × 24 elements. source..
Content:
In [1]: import numpy as np import math import pandas as pd from datascience import * In [2]: #Question 1.1.1 pi = np.pi e = np.e interesting_numbers = np.array([0, 1, -1, pi, e]) print('interesting_numbers:', interesting_numbers) interesting_numbers: [ 0. 1. -1. 3.14159265 2.71828183] In [3]: #Question 1.1.2 hello_world_components = np.array(["Hello", ",", " ", "world", "!"]) print("hello_world_components:", hello_world_components) hello_world_components: ['Hello' ',' ' ' 'world' '!'] In [4]: #Question 1.1.3 #Create an array with multiples of 99 from 0 to 9999 multiples_of_99 = np.arange(0, 10000, 99) multiples_of_99 Out[4]: array([ 0, 99, 198, 297, 396, 495, 594, 693, 792, 891, 990, 1089, 1188, 1287, 1386, 1485, 1584, 1683, 1782, 1881, 1980, 2079, 2178, 2277, 2376, 2475, 2574, 2673, 2772, 2871, 2970, 3069, 3168, 3267, 3366, 3465, 3564, 3663, 3762, 3861, 3960, 4059, 4158, 4257, 4356, 4455, 4554, 4653, 4752, 4851, 4950, 5049, 5148, 5247, 5346, 5445, 5544, 5643, 5742, 5841, 5940, 6039, 6138, 6237, 6336, 6435, 6534, 6633, 6732, 6831, 6930, 7029, 7128, 7227, 7326, 7425, 7524, 7623, 7722, 7821, 7920, 8019, 8118, 8217, 8316, 8415, 8514, 8613, 8712, 8811, 8910, 9009, 9108, 9207, 9306, 9405, 9504, 9603, 9702, 9801, 9900, 9999]) In [5]: #Question 1.1.4 #Calculate the number of hours in December (31 days * 24 hours/day) hrs_in_dec = 31 * 24 #Create an array of the time in seconds since the start of the month collection_times = np.arange(0, hrs_in_dec * 3600, 3600) print("collection_times:", collection_times, len(collection_times)) collection_times: [ 0 3600 7200 10800 14400 18000 21600 25200 28800 32400 36000 39600 43200 46800 50400 54000 57600 61200 64800 68400 72000 75600 79200 82800 86400 90000 93600 97200 100800 104400 108000 111600 115200 118800 122400 126000 129600 133200 136800 140400 144000 147600 151200 154800 158400 162000 165600 169200 172800 176400 180000 183600 187200 190800 194400 198000 201600 205200 208800 212400 216000 219600 223200 226800 230400 234000 237600 241200 244800 248400 252000 255600 259200 262800 266400 270000 273600 277200 280800 284400 288000 291600 295200 298800 302400 306000 309600 313200 316800 320400 324000 327600 331200 334800 338400 342000 345600 349200 352800 356400 360000 363600 367200 370800 374400 378000 381600 385200 388800 392400 396000 399600 403200 406800 410400 414000 417600 421200 424800 428400 432000 435600 439200 442800 446400 450000 453600 457200 460800 464400 468000 471600 475200 478800 482400 486000 489600 493200 496800 500400 504000 507600 511200 514800 518400 522000 525600 529200 532800 536400 540000 543600 547200 550800 554400 558000 561600 565200 568800 572400 576000 579600 583200 586800 590400 594000 597600 601200 604800 608400 612000 615600 619200 622800 626400 630000 633600 637200 640800 644400 648000 651600 655200 658800 662400 666000 669600 673200 676800 680400 684000 687600 691200 694800 698400 702000 705600 709200 712800 716400 720000 723600 727200 730800 734400 738000 741600 745200 748800 752400 756000 759600 763200 766800 770400 774000 777600 781200 784800 788400 792000 795600 799200 802800 806400 810000 813600 817200 820800 824400 828000 831600 835200 838800 842400 846000 849600 853200 856800 860400 864000 867600 871200 874800 878400 882000 885600 889200 892800 896400 900000 903600 907200 910800 914400 918000 921600 925200 928800 932400 936000 939600 943200 946800 950400 954000 957600 961200 964800 968400 972000 975600 979200 982800 986400 990000 993600 997200 1000800 1004400 1008000 1011600 1015200 1018800 1022400 1026000 1029600 1033200 1036800 1040400 1044000 1047600 1051200 1054800 1058400 1062000 1065600 1069200 1072800 1076400 1080000 1083600 1087200 1090800 1094400 1098000 1101600 1105200 1108800 1112400 1116000 1119600 1123200 1126800 1130400 1134000 1137600 1141200 1144800 1148400 1152000 1155600 1159200 1162800 1166400 1170000 1173600 1177200 1180800 1184400 1188000 1191600 1195200 1198800 1202400 1206000 1209600 1213200 1216800 1220400 1224000 1227600 1231200 1234800 1238400 1242000 1245600 1249200 1252800 1256400 1260000 1263600 1267200 1270800 1274400 1278000 1281600 1285200 1288800 1292400 1296000 1299600 1303200 1306800 1310400 1314000 1317600 1321200 1324800 1328400 1332000 1335600 1339200 1342800 1346400 1350000 1353600 1357200 1360800 1364400 1368000 1371600 1375200 1378800 1382400 1386000 1389600 1393200 1396800 1400400 1404000 1407600 1411200 1414800 1418400 1422000 1425600 1429200 1432800 1436400 1440000 1443600 1447200 1450800 1454400 1458000 1461600 1465200 1468800 1472400 1476000 1479600 1483200 1486800 1490400 1494000 1497600 1501200 1504800 1508400 1512000 1515600 1519200 1522800 1526400 1530000 1533600 1537200 1540800 1544400 1548000 1551600 1555200 1558800 1562400 1566000 1569600 1573200 1576800 1580400 1584000 1587600 1591200 1594800 1598400 1602000 1605600 1609200 1612800 1616400 1620000 1623600 1627200 1630800 1634400 1638000 1641600 1645200 1648800 1652400 1656000 1659600 1663200 1666800 1670400 1674000 1677600 1681200 1684800 1688400 1692000 1695600 1699200 1702800 1706400 1710000 1713600 1717200 1720800 1724400 1728000 1731600 1735200 1738800 1742400 1746000 1749600 1753200 1756800 1760400 1764000 1767600 1771200 1774800 1778400 1782000 1785600 1789200 1792800 1796400 1800000 1803600 1807200 1810800 1814400 1818000 1821600 1825200 1828800 1832400 1836000 1839600 1843200 1846800 1850400 1854000 1857600 1861200 1864800 1868400 1872000 1875600 1879200 1882800 1886400 1890000 1893600 1897200 1900800 1904400 1908000 1911600 1915200 1918800 1922400 1926000 1929600 1933200 1936800 1940400 1944000 1947600 1951200 1954800 1958400 1962000 1965600 1969200 1972800 1976400 1980000 1983600 1987200 1990800 1994400 1998000 2001600 2005200 2008800 2012400 2016000 2019600 2023200 2026800 2030400 2034000 2037600 2041200 2044800 2048400 2052000 2055600 2059200 2062800 2066400 2070000 2073600 2077200 2080800 2084400 2088000 2091600 2095200 2098800 2102400 2106000 2109600 2113200 2116800 2120400 2124000 2127600 2131200 2134800 2138400 2142000 2145600 2149200 2152800 2156400 2160000 2163600 2167200 2170800 2174400 2178000 2181600 2185200 2188800 2192400 2196000 2199600 2203200 2206800 2210400 2214000 2217600 2221200 2224800 2228400 2232000 2235600 2239200 2242800 2246400 2250000 2253600 2257200 2260800 2264400 2268000 2271600 2275200 2278800 2282400 2286000 2289600 2293200 2296800 2300400 2304000 2307600 2311200 2314800 2318400 2322000 2325600 2329200 2332800 2336400 2340000 2343600 2347200 2350800 2354400 2358000 2361600 2365200 2368800 2372400 2376000 2379600 2383200 2386800 2390400 2394000 2397600 2401200 2404800 2408400 2412000 2415600 2419200 2422800 2426400 2430000 2433600 2437200 2440800 2444400 2448000 2451600 2455200 2458800 2462400 2466000 2469600 2473200 2476800 2480400 2484000 2487600 2491200 2494800 2498400 2502000 2505600 2509200 2512800 2516400 2520000 2523600 2527200 2530800 2534400 2538000 2541600 2545200 2548800 2552400 2556000 2559600 2563200 2566800 2570400 2574000 2577600 2581200 2584800 2588400 2592000 2595600 2599200 2602800 2606400 2610000 2613600 2617200 2620800 2624400 2628000 2631600 2635200 2638800 2642400 2646000 2649600 2653200 2656800 2660400 2664000 2667600 2671200 2674800] 744 In [5]: #Question1.2.1 population_amounts = np.array([3070043704, 3967226955, 3838395618, 4967981410, 5477939000, 6068051718, 1418205317, 4168513437, 4259766092, 5332187700, 7405299858]) population_1973 = population_amounts.item(3) print("population_1973:", population_1973) population_1973: 4967981410 In [6]: #Queswtion 1.3.1 population_magnitudes = np.log10(population_amounts) #Print the result print("population_magnitudes:", population_magnitudes) population_magnitudes: [ 9.48714456 9.59848705 9.58414973 9.69617996 9.73861719 9.78304927 9.15173911 9.61998121 9.62938575 9.72690543 9.86954265] In [7]: #if there's an array named restaurant_bills containing the original bill amounts #Compute the total charge for each bill, including a 20% tip restaurant_bills = make_array(20.12, 39.90, 31.01) print("Restaurant bills:\t", restaurant_bills) #Array multiplication tips = 0.2 * restaurant_bills print("Tips:\t\t\t", tips) total_charges = restaurant_bills * 1.2 print("total_charges:", total_charges) Restaurant bills: [ 20.12 39.9 31.01] Tips: [ 4.024 7.98 6.202] total_charges: [ 24.144 47.88 37.212] In [ ]: #Question 1.3.3 more_restaurant_bills = Table.read_table("more_restaurant_bills.csv").column("Bill Amount") #Calculate the total charge for each bill more_total_charges = more_restaurant_bills * 1.2 sum_of_bills = np.sum(more_total_charges) sum_of_bills ...
Get the Whole Paper!
Not exactly what you need?
Do you need a custom essay? Order right now:

Other Topics:

  • The Knowledge of Bandwidth in Communication Network
    Description: The knowledge of bandwidth in communication networks can be useful in various applications. Some popular examples are validation of service level agreements, traffic engineering and capacity planning support, detection of congested or underutilized links, optimization of network route selection, dynamic ...
    16 pages/≈4400 words| 44 Sources | Other | IT & Computer Science | Other (Not Listed) |
  • Creating Accessible Documents in Microsoft Powerpoint IT Paper
    Description: The core components to incorporate to the presentation are the use of Alternate Text for visuals, Slide Titles and Design, Order of Slide Contents, Meaningful Hyperlinks, Accessible Tables, Text Accessibility and Color Scheme, and Accessible Videos. Follow the practices below...
    1 page/≈550 words| 1 Source | Other | IT & Computer Science | Other (Not Listed) |
  • Creating Accessible Documents in Microsoft Word IT & Computer Paper
    Description: he core components to incorporate to the word document are the use of Headings, Lists, Alternate Text for visuals, Meaningful hyperlinks, Accessible Tables, and Color scheme. Follow the practices below for creating accessible Word documents....
    1 page/≈550 words| 1 Source | Other | IT & Computer Science | Other (Not Listed) |
Need a Custom Essay Written?
First time 15% Discount!