<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chinenye Precious Nwachukwu on Medium]]></title>
        <description><![CDATA[Stories by Chinenye Precious Nwachukwu on Medium]]></description>
        <link>https://medium.com/@preciousnwachukwu067?source=rss-c2a9b2a4dec5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*02b4WL6vjlyZyNBY</url>
            <title>Stories by Chinenye Precious Nwachukwu on Medium</title>
            <link>https://medium.com/@preciousnwachukwu067?source=rss-c2a9b2a4dec5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 03:49:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@preciousnwachukwu067/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Week 11: Data Structure and Algorithms 1.]]></title>
            <link>https://medium.com/@preciousnwachukwu067/week-11-data-structure-and-algorithms-1-ab16c5211bb0?source=rss-c2a9b2a4dec5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab16c5211bb0</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[dsa-problem]]></category>
            <dc:creator><![CDATA[Chinenye Precious Nwachukwu]]></dc:creator>
            <pubDate>Sun, 29 Nov 2026 18:35:35 GMT</pubDate>
            <atom:updated>2026-11-30T01:57:08.659Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ONIvk1BeswT860eUrKY3vw.png" /><figcaption>DSA</figcaption></figure><h3>Introduction</h3><p>Week 11 was focused on data structure and algorithms. I learnt about algorithms and Big O, hash map,linked List,stack, queue and recursion.</p><h3><strong>What I learnt</strong></h3><p><strong>Algorithms and Big O Notation</strong></p><p>I learnt that an algorithm is a finite list of clear steps that turns an input into an output. There are five characteristics of algorithms</p><p>a. input : an algorithm must have a set of input</p><p>b. output : an algorithm must produce one or more results.</p><p>c. finite: there is always an end.</p><p>d. definite:the steps are exact.</p><p>e. correct: the output will always be correct.</p><p><strong>Big O Notation</strong></p><p>I learnt that big O notation keeps only the parts that dominates for large n.</p><p>Big O has two other siblings:</p><p>a. <strong>Ω(g) (Big-Omega)</strong>- grows at least like g(lower bound)</p><p>b. <strong>Θ(g) (Big-Theta)-</strong>grows exactly like g.</p><p><strong><em>The type of class in Big O</em></strong></p><p>I learnt the class of big O which includes:</p><ol><li>O(1)- constant</li><li>O (log n)- logarithmic</li><li>O(n) — linear.</li><li>O (n log n)- linear arithmetic</li><li>O(n^2)-quadratic</li><li>O(2^n)- exponential.</li></ol><p><strong>Best, average and worst case</strong></p><ul><li>best O(1)- the luckiest input</li><li>average O(n)- a typical random input.</li><li>worst O(n)-the unluckiest input.</li></ul><p>I learnt that the worst case is always to be quoted as it is a promise it will never be slower than this.</p><p><strong>Space Complexity</strong></p><p>I learnt that space Complexity is how much extra memory an algorithm needs as n grows.</p><p><strong>Amortized Analysis</strong></p><p>Amortized analysis is a technique used in algorithm analysis to determine the average cost of an operation over a sequence of operations. It helps us understand how efficient an algorithm is when some operations are occasionally expensive, but most operations are cheap.</p><p><strong>Hash Map and Sets</strong></p><p>I learnt that a hash map is a data structure that stores information in key-value pairs.</p><p><strong><em>hash function</em></strong></p><p>I learnt that hash function takes a key and returns an integer called the key’s hash.</p><p>I learnt that the hash function has three properties:</p><p>a. Deterministic</p><p>b. Fast</p><p>c. Spread Key</p><p><strong>hash collisions</strong></p><p>I learnt that a collision happens when two different keys lands in the same bucket. I learnt that it is almost impossible for a hash function to completely avoid collision.</p><p><em>The types of Collision strategy includes:</em></p><p>a. Separate Chaining: here, each bucket holds a small list of all the key that landed there.</p><p>b. Open addressing — everything lives in one array if the slot is taken probe for the next free slot.</p><p><strong>Linked List</strong></p><p>Linked List are data held together by pointers not by position.</p><p>What this taught me is that linked List shows up in everyday app we use like bank app, music app in:</p><ol><li>undo history and browser back and forward.</li><li>Hash table chain</li><li>the adjacency list of graphs.</li></ol><p>I learnt that linked List scatter items anywhere in memory as individual Node Objects and each node holds a value and a pointer.</p><p>The three types of Linked lists include:</p><p>1.Singly Linked List</p><p>2. Double Linked List</p><p>3. Circular Linked List.</p><p>I learnt that the linked List is made of nodes and pointers.</p><p>The mode holds 2 things:</p><p>a. a value.</p><p>b. a pointer to the next node.</p><p><strong>Stacks and Queues</strong></p><p>a <strong>stack</strong> follows the rule that the items added last is the first item to be removed (LIFO- last in first out).</p><p>Operations of stack includes:</p><p>a. push</p><p>b. pop</p><p>c. peek</p><p>d. is_empty</p><p>e. len</p><p><strong>Queue </strong>follows<strong> </strong>the rule that the first item added is the first to be removed (FIFO- First in, First out) example a queue at the bank, the first person on the line will be the first that will be attended to.</p><p>Operations of Queue.</p><p>a. enqueue</p><p>b. dequeue</p><p>c. front</p><p><strong>Recursion</strong></p><p>I learnt that recursion is a function that calls itself. it means solving a problem by solving a smaller copy of the same problem first.</p><p><strong><em>There are three rules of a correct recursion function:</em></strong></p><p>1.Base case: one input that can be answered directly.</p><p>2. progress</p><p>3. Trust which is the leap of faith.</p><p><strong><em>Recursion limit</em></strong></p><p>I learnt that if recursion never stops, the stack would use up all the memory and the whole program will crash. in order to prevent this,python stops depth at 1000 and raises a recursion error.</p><p><strong>Challenges I Encountered and How I Overcame them</strong></p><ol><li><strong><em>Understanding data structure and algorithms concepts:</em></strong></li></ol><p>This challenge was tough as I tried understanding what the different data structure and algorithms like recursion, linked List, stack and queues were saying the harder it gets. How I overcame this challenge was to go beyond my learning notes by searching for additional explanations and practical examples to each concept.</p><p>2. <strong><em>Approach Problem:</em></strong></p><p>Another major challenge was looking at a coding problem and figuring out how to approach it. I overcame this by breaking problems into smaller, manageable steps instead of trying to solve everything at once.</p><h3><strong>What I solved/ work on</strong></h3><ol><li><strong>Arrays &amp; two pointers:</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*7fLh3BPEYUkqQ63Ojke23w.png" /></figure><p><em>Steps I took in Solving this Problem</em></p><p>a. I first of all used an if statement to check if k is valid.</p><pre>if k&lt;= 0  or k &gt; len(nums):<br>        return None</pre><p>b. I then calculated the sum of the first k elements and stored the initial maximum number.</p><pre># Calculate the sum of the  of the first k elements<br>    window_sum=sum(nums[:k])<br><br>    # Store the initial maximum<br>    max_sum= window_sum</pre><p>c. I created a for loop to slide the window through the remaining elements.</p><pre># slide the window<br>for i in range(k, len(nums)):<br><br>         window_sum = window_sum - nums[i-k] + nums[i]<br><br>         # Update the maximum<br>         max_sum = max(max_sum, window_sum)<br><br>    return max_sum</pre><h4>2. <strong>Hashing: Group anagrams</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*AA8-_3SquDGVyEGGRCVhLQ.png" /></figure><h4>3. <strong>Linked lists, stacks &amp; queues: Reverse a linked list</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*T2p_LecPNZpDb9hv58oKPA.png" /></figure><h3>Conclusion</h3><p>One thing I find particularly interesting about Data Structures and Algorithms is that the knowledge goes beyond coding. It also relates to how we approach problems and find efficient ways to solve them, even in our everyday experiences.</p><p>One thing I&#39;ve also come to realize from this week&#39;s learning is that this isn&#39;t something I can learn once and expect to master immediately. It requires constant practice, patience, and a willingness to keep looking at problems from different perspectives.</p><p>It&#39;s a continuous learning process, and I&#39;m looking forward to getting better at it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab16c5211bb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 8: Grouping of Data and Data Visualization]]></title>
            <link>https://medium.com/@preciousnwachukwu067/week-8-groupby-matplotlib-and-seaborn-2f730f374b08?source=rss-c2a9b2a4dec5------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f730f374b08</guid>
            <dc:creator><![CDATA[Chinenye Precious Nwachukwu]]></dc:creator>
            <pubDate>Sun, 01 Nov 2026 06:53:56 GMT</pubDate>
            <atom:updated>2026-11-01T06:55:23.008Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fWMZnVR1VJgmICJ9tz4_CA.png" /></figure><p><strong>INRODUCTION</strong></p><p>Week 8 was focused on grouping of data in python and the use of matplotlib and seaborn libraries to visualize data.</p><h3><strong>What I learnt</strong></h3><p>This week, I learnt how to use groupby() method to split data into groups, apply an aggregation function and combine the results.</p><p>I also learnt about using maplotlib and seaborn library for data visualization. Data visualization is important as it help us identify trends and pattens easier and faster. It also useful for comparism.</p><h3><strong>What I Solved</strong></h3><p>This week, I worked on analyzing Nigeria’s exports and imports on three commodities: Rice, Cocoa beans; whole or broken, raw or roasted and Wheat or meslin flour for different trading partners of Nigeria for the year 2023.</p><p>I downloaded the data set UN comtrade website and began my data cleaning and analysis process.</p><p>I started by importing pandas in my notebook and read my downloaded csv data into a dataframe.</p><pre>import pandas as pd<br>#reading the dataset<br>nigeria_data=pd.read_excel(&#39;TradeData.csv&#39;)<br>nigeria_data.head()</pre><p>I did not need every column in my nigeria_data table so I choose the table that will be needed for my analysis.</p><pre>#Choosing Columns<br><br>COLUMNS=[&#39;refPeriodId&#39;,&#39;refYear&#39;,&#39;refMonth&#39;,&#39;reporterDesc&#39;,&#39;flowDesc&#39;,&#39;partnerDesc&#39;,&#39;cmdCode&#39;,&#39;cmdDesc&#39;,&#39;primaryValue&#39;]<br>nigeria_data=nigeria_data[COLUMNS]<br>nigeria_data.head()</pre><p>For cleaning the data, I had to rename the data to an appropriate name</p><pre>#Rename columns<br><br>nigeria_data=nigeria_data.rename(columns={<br>    &#39;refPeriodId&#39;:&#39;Period&#39;,<br>    &#39;refYear&#39;:&#39;Year&#39;,<br>    &#39;refMonth&#39;:&#39;Month&#39;,<br>    &#39;reporterDesc&#39;:&#39;Reporter&#39;,<br>    &#39;flowDesc&#39;:&#39;Trade Flow&#39;,<br>    &#39;partnerDesc&#39;:&#39;Partner&#39;,<br>    &#39;cmdCode&#39;:&#39;Commodity Code&#39;,<br>    &#39;cmdDesc&#39;:&#39;Commodity&#39;,<br>    &#39;primaryValue&#39;:&#39;Trade Value (US$)&#39;<br>})<br><br>nigeria_data.head()</pre><p>I excluded partners called ‘World’ from my data set</p><pre>#Exclude &#39;World&#39; Partner<br><br>nigeria_data_countries = nigeria_data[nigeria_data[&#39;Partner&#39;] != &#39;World&#39;]<br>nigeria_data_countries.head()</pre><p>I wanted to finding the most significant trade partner in each case by commodity, or commodity code. I grouped my dataset by Commodity and Partner and aggregated by Trade Value (US$)’</p><pre>#Grouping by commodity and Partner<br>commodity_partner_group= nigeria_data_countries.groupby([&#39;Commodity&#39;, &#39;Partner&#39;])[&#39;Trade Value (US$)&#39;].sum().reset_index()<br>#sorting &#39;Trade Value (US$)&#39; by decending order<br>sorted_groups=commodity_partner_group.sort_values(&#39;Trade Value (US$)&#39;, ascending=False)<br># Group by Commodity and grab the first row of each group-the max <br>top_partner_per_commodity = sorted_groups.groupby(&#39;Commodity&#39;).first().reset_index()<br>top_partner_per_commodity </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*fE9RYvTIeUeQHHieeRiHMA.png" /></figure><p>In the solution above, Netherlands is the most significant partner for the commodity Rice, India is the significant partner for Rice and United Arab Emirates is the significant partner for the commodity Wheat.</p><p><em>I also did an analysis on finding the most significant trade partner by trade flow, commodity and year. To solve this problem, I grouped the dataset by </em>‘Trade Flow’,’Commodity’, ’Year’, ‘Partner’. Sorted the data in descending order by Trade Value (US$). I use the sort_values() method, first and reset_index() to find the first row with the highest Trade Value (US$) for each category.</p><pre># Grouping by Trade Flow, Commodity, Year and Partner<br>groupings= nigeria_data_countries.groupby([&#39;Trade Flow&#39;,&#39;Commodity&#39;,&#39;Year&#39;, &#39;Partner&#39;])[&#39;Trade Value (US$)&#39;].sum().reset_index()<br><br>#Sort by Trade Value (US$) and store it in a variable sorted_flow_commodity_year<br>sorted_flow_commodity_year = groupings.sort_values(&#39;Trade Value (US$)&#39;, ascending=False)<br><br>#  Extract the highest trade partner row for each category <br>top_partner_by_flow_commodity_year = sorted_flow_commodity_year.groupby([&#39;Trade Flow&#39;, &#39;Commodity&#39;, &#39;Year&#39;]).first().reset_index()<br><br># Groups by Trade Flow and  Trade Value (US$) and ranks highest trade values first<br>top_partner_by_flow_commodity_year.sort_values([&#39;Trade Flow&#39;, &#39;Trade Value (US$)&#39;], ascending=[True, False]).reset_index(drop=True)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*yOU7FiwuY544ePe-O0-fXQ.png" /></figure><p>The analysis revealed that the Netherlands recorded an export trade value of $263,139,700 for Cocoa beans (whole or broken, raw or roasted) from Nigeria. Niger recorded an export trade value of $289,634,800 for Wheat or meslin flour from Nigeria and there was no export of rice from Nigeria. The highest significant importer partner in Nigeria is Netherland (Cocoa beans; whole or broken, raw or roasted), India (Rice), United Arab Emirates (Wheat or meslin flour) with trade value of $128,036,200, $865,809,000 and $352,169,900.</p><p>I also find the month with the highest total value of Import and Export.</p><pre># finding the month with the highest total value of imports<br>nigeria_data_countries_imports.groupby([&#39;Month&#39;,&#39;Trade Flow&#39;])[&#39;Trade Value (US$)&#39;].aggregate(&#39;sum&#39;).sort_values(ascending=False).head(5)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*Yx6hYDL3m8EAT2BDkoOOeQ.png" /></figure><pre># finding the month with the highest total value of exports<br>nigeria_data_countries_exports=nigeria_data_countries[nigeria_data_countries[&#39;Trade Flow&#39;] == &#39;Export&#39;]<br><br>nigeria_data_countries_exports.groupby([&#39;Month&#39;,&#39;Trade Flow&#39;])[&#39;Trade Value (US$)&#39;].aggregate(&#39;sum&#39;).sort_values(ascending=False).head(5)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*UL3cyKyvnpkgG_1XPhzjdw.png" /></figure><p>November is the highest total value for import with the sum of $132,960.837 and December has the highest total value for export with the total of $123,549,600</p><p>I plotted a bar chart to show the 3 top Partner exporter and importer.</p><pre>#Top 3 importers<br>nigeria_data_countries_imports.groupby([&#39;Partner&#39;,&#39;Trade Flow&#39;])[&#39;Trade Value (US$)&#39;].aggregate(&#39;sum&#39;).sort_values(ascending=False).head(3).plot(kind=&#39;barh&#39;, title=&#39;Top 3 Importers&#39;, xlabel=&#39;Trade Value (US$)&#39;, ylabel=&#39;Partner&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*vJbR_8zfClBh66x9cN8Iqg.png" /></figure><p>From the chart we can see that Netherlands is the highest importer of product to Nigeria, followed by India and China.</p><pre>nigeria_data_countries_exports.groupby([&#39;Partner&#39;,&#39;Trade Flow&#39;])[&#39;Trade Value (US$)&#39;].aggregate(&#39;sum&#39;).sort_values(ascending=False).head(3).plot(kind=&#39;barh&#39;, title=&#39;Top 3 Importers&#39;, xlabel=&#39;Trade Value (US$)&#39;, ylabel=&#39;Partner&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*w7AnRFIUsZAPejlazPijIw.png" /></figure><p>From the chart, Nigeria mostly exports to the Netherland, followed by Malaysia, Inonesia. From both chart we can see we have a two way relationship between Nigeria and Netherlands.</p><p><strong>Questions</strong></p><p><em>a. how much does the Nigeria exports and imports and is the balance positive (more exports than imports)</em></p><pre>grouped1 = nigeria_data_countries.groupby(&#39;Trade Flow&#39;)<br>grouped1[&#39;Trade Value (US$)&#39;].aggregate(sum)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*hfYiXWF6jbQbD1dNo-HQcw.png" /></figure><p>Nigeria export is a total of approximately 669,185,900 and import is a total of approximately $360,919,500.</p><p>There is a positive balance from the difference between export and import of approximately $ 308,266,400.</p><p><em>b. Which are the main trading partners, i.e. from/to which countries do the Nigeria import/export the most?</em></p><pre>#for imports<br>grouped = imports.groupby(&#39;Partner&#39;)<br><br>print(&#39;The Nigeria imports from&#39;, len(grouped), &#39;countries.&#39;)<br>print(&#39;The 5 biggest exporters to Nigeria are:&#39;)<br>totalImports = grouped[&#39;Trade Value (US$)&#39;].aggregate(sum).sort_values(inplace=False,ascending=False)<br>totalImports.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*JsjuhVPiDPjEufN28KNRmA.png" /></figure><p>Chart for Importers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*DbAT4cADzTMgkO5sPLSXJg.png" /></figure><pre>#For Exports<br>exports = nigeria_data_countries[nigeria_data_countries[&#39;Trade Flow&#39;] == &#39;Export&#39;]<br>grouped = exports.groupby(&#39;Partner&#39;)<br><br>print(&#39;Nigeria exports to&#39;, len(grouped), &#39;countries.&#39;)<br>print(&#39;The 5 biggest importers from Nigeria are:&#39;)<br>totalExports = grouped[&#39;Trade Value (US$)&#39;].aggregate(sum).sort_values(inplace=False,ascending=False)<br>totalExports.head(10).plot(kind=&#39;barh&#39;)</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*RDoqUX3jD_CVChHwkZjiAA.png" /></figure><p>Chart:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*Gg4XSmx92K3slT6xhuWn3Q.png" /></figure><p>c. Which countries does the Nigeria both import from and export to?’</p><pre>countries = pivot_table(nigeria_data_countries, index=[&#39;Partner&#39;], columns=[&#39;Trade Flow&#39;], <br> values=[&#39;Trade Value (US$)&#39;], aggfunc=sum)<br>countries.head()<br>countries.dropna()</pre><p>Answer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*vc6RPE8Kn6PGx_qYwSXfXw.png" /></figure><p>Nigeria both export and import from Canada, China, India, Japan, Netherlands and USA.</p><h3><strong>Challenges I faced</strong></h3><p>One of the major challenges I encountered was during the data retrival from UN Comtrade website. Although there was a limit of 500 records that I can retrieve but I could only retrive 170 rows from the website. This limited the amount of information availiable for my analysis and does not fully represent Nigeria trade transaction.</p><p>I overcame this by proceeding with the data I was able to retrieve. I cleaned the data ,selected the important columns for my analysis. I intrepreted my findings within the scope of the data availiable to me.</p><h3><strong><em>Conclusion</em></strong></h3><p>One thing I am taking away from this week is to look deeply and understand what each piece of data represent and asking the right questions is just as important as performing the analysis because the questions we ask guide the insights we uncover.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f730f374b08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 7 Internship Journey: Data Cleaning and Transformation Is a Must!]]></title>
            <link>https://medium.com/@preciousnwachukwu067/week-7-internship-journey-data-cleaning-and-transformation-is-a-must-3f7cb64504ed?source=rss-c2a9b2a4dec5------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f7cb64504ed</guid>
            <dc:creator><![CDATA[Chinenye Precious Nwachukwu]]></dc:creator>
            <pubDate>Sat, 24 Oct 2026 12:11:00 GMT</pubDate>
            <atom:updated>2026-10-24T12:11:00.707Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MTsgnGQ9TebQgkZ3_H9IJw.png" /></figure><h3><strong>INTRODUCTION</strong></h3><p>Week 7 of my learning journey with Dataraflow took me into data cleaning and transformation using python pandas and SQL. Really, I did not know what this week holds because last week was tough. But this week was really interesting as I got to understand why data cleaning and transformation is really important for accurate insights.</p><p>Let’s dive right in!</p><h3><strong>What I Learnt</strong></h3><p>This week I leant how to clean data in python. Data may not come in a clean form. Some may have empty spaces, missing values,incorrect data type, wrong spelling, unstandardize data structure e.t.c. It is important that data are clean to generate accurate findings.</p><p><strong><em>Removing Empty Spaces</em></strong></p><p>I learnt that empty spaces in data and column headings can cause error when trying to work with the data because we have to be extra careful of the spaces. when loading csv data into python, argument<em> ‘skipintialspace=True’ </em>can be added<em> </em>to remove those leading spaces in the colums and data<em>.</em></p><pre>import pandas as pd<br>london_2023= pd.read_csv(&#39;london_weather_2023.csv&#39;,skipintialspace=True)</pre><p>or use the str.strip() functions to remove those spaces.</p><pre>london_2023.columns= london_2023.colomns.str.strip()</pre><p>The code above removes empty space before and after the individual column header.</p><p><strong><em>Renaming data</em></strong></p><p>Some columns or index may not be in the wordings we want it or may have an error in it, so it is important to rename them. In my learning this week, there was a column that had the &lt;br /&gt; tag that came along with the data when it was imported in the database so it had to be renamed.Below is the code for renaming WindDirDegrees&lt;br /&gt; column to WindDirDegrees.</p><pre>london = london.rename(columns={&#39;WindDirDegrees&lt;br /&gt;&#39; : &#39;WindDirDegrees&#39;})</pre><p><strong><em>Removing character at the end of element</em></strong></p><p>The rstrip() is a function can be use to remove unwanted character at the end of an element. For example, remove the extra &lt;br /&gt; for the data element of the WindDirDegrees. I use the str.rstrip() function.</p><pre>london[&#39;WindDirDegrees&#39;] = london[&#39;WindDirDegrees&#39;].str.rstrip(&#39;&lt;br /&gt;&#39;)</pre><p><strong><em>Missing values</em></strong></p><p>Missing values is another problem a dataset may have. It is important to clean missing values from our data as this is a data quality issue and may affect the analysis of the data. The options available for cleaning missing values is to:</p><p>i. Drop the missing value.</p><p>ii. Replace missing values with a fixed value.</p><p>iii. Replace value with mean, mode or median.</p><p>To check if your data have null in it, you use the data.isnull()</p><pre>london.isnull()<br>london.isnull().sum()</pre><p>the will give you a series of True or False. True indicating that the value is null and False indicating the value is not null. It is also possible to get the total counts of the nulls using isnull().sum(). One important take away I got from this learning is that null does not mean empty string or zero, it might mean the value is not availiable or is missing.</p><p>To drop missing value from a data or column we use the data.dropna(). This drop the nulls in the dataset or column.</p><pre>data.dropna()</pre><p>To fill up null with a value, the fillna function is vary usefull.</p><pre>#filling nulls with the value 1<br>data=data.fillna(1)</pre><p><strong><em>Changing datatypes of columns</em></strong></p><p>Data types of columns may not be in their standard types. For example a number column having a data type of string or a date column having the data type of string. It is important to change the data type to their appropriate format so that it can be usable. Changing data types of columns is a very important step in data cleaning as you can not work with aggregate function (sum, min, max, mean) with a number column with a string data type.</p><p>To change the data type of a number column with a data type of string, the astype() function can be used.</p><p>For example changing the WindDirDegrees column to interger</p><pre>london[&#39;WindDirDegrees&#39;] = london[&#39;WindDirDegrees&#39;].astype(&#39;int64&#39;) </pre><p>Also, it is important that date columns should be changed from string data type to a datetime datatype. To do this is important to import pandas and use the to_datetime() to change the date column to a datetime data type.</p><p>For Example:Changing the GMT column to a datetime data type.</p><pre>london[&#39;GMT&#39;] = pd.to_datetime(london[&#39;GMT&#39;])</pre><p>To check the datatypes of columns, the ‘dtype’ function is used.</p><p><strong><em>Plotting</em></strong></p><p>I also learnt how to plot a chart using the matplotlib library.</p><pre>london[[&#39;Max Wind SpeedKm/h&#39;, &#39;Mean Wind SpeedKm/h&#39;]].plot(grid=True, figsize=(10,5))</pre><p><strong><em>Changing the Index</em></strong></p><p>The index of a dataset might require changing it to one of the columns in a dataset to do this, the index will be assigned to a column.</p><pre>london.index = london[&#39;GMT&#39;]</pre><p>It will be also necessary to sort the index and the sort_values() function is used.</p><pre>london = london.sort_index()</pre><p><strong><em>Merging Tables/ dataset</em></strong></p><p>I learnt about combining two dataset or table using the merge function. There are differnt types of Joining, the <em>left</em> join combines the left table and only matching row from the right table, <em>the right</em> join returns all elements from the right table and only matching elements from the left table, the inner join only returns element that matches from both the left and right table, the outer joins combines the tables together.</p><p>The “on” keyword names the common column on which te table will be combined.</p><p>The “how” keyword specify how the table will be combined:left,right,inner or outer.</p><pre>#left join<br>pd.merge(gdp, life, on=&#39;Country name&#39;, how=&#39;left&#39;)</pre><pre>#right join<br>pd.merge(gdp, life, on=&#39;Country name&#39;, how=&#39;right&#39;)</pre><pre>#outer join<br>pd.merge(gdp, life, on=&#39;Country name&#39;, how=&#39;outer&#39;)</pre><pre>#inner join<br>pd.merge(gdp, life, on=&#39;Country name&#39;, how=&#39;inner&#39;)</pre><h3><strong>Tasks I Worked On.</strong></h3><h4>Cleaning and Visualizing Data</h4><p><strong>Task 1</strong>. write code to select all days that had a northerly wind (select the rows where the direction is greater than or equal to 350 <strong>or</strong> smaller than or equal to 10)</p><p>First of all, I started by cleaning the table week07.london_2014 dataset.</p><ul><li>I remove extra spaces from the columns using str.strip()</li></ul><pre>#Removing spaces from the columns<br>london.columns=london.columns.str.strip()<br>london.columns</pre><ul><li>I renamed the column WindDirDegrees&lt;br /&gt; to WindDirDegrees</li></ul><pre>#Removing extra characters<br><br>london[&#39;WindDirDegrees&lt;br /&gt;&#39;].head()<br><br>#renaming &#39;WindDirDegrees&lt;br /&gt;&#39; to &#39;WindDirDegrees&#39;<br><br>london = london.rename(columns={&#39;WindDirDegrees&lt;br /&gt;&#39;:&#39;WindDirDegrees&#39;})</pre><ul><li>I removed the unwanted character from the column WindDirDegrees using the string str.rstrip</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fer9eyPTZyJvegPyGCFpgA.png" /></figure><ul><li>I checked for null values in Events colums and replace those nulls in the column with an empty string.</li></ul><pre>#Cheacking and removing nulls from the Events column<br><br>#checking for null in the event table<br>london[london[&#39;Events&#39;].isnull()]</pre><pre>#filling missing values in Events column<br><br>london[&#39;Events&#39;]=london[&#39;Events&#39;].fillna(&#39;&#39;)<br><br>#checking if there any missing values in Event column<br>london[london[&#39;Events&#39;].isnull()]</pre><ul><li>I droped null value from the table.</li></ul><pre>#Dropping null values in the table london<br>london.dropna()</pre><ul><li>I changed the WindDirDegrees column data type from str to interger</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SaZBsr2U3VaehAkdTfBLAw.png" /></figure><p>Now that data type of WindDirDegrees column have been change to an interger I can now work on my task 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nt0qOKYm6xKJ1_qtwnKoOw.png" /></figure><p>For task 1, I got 5 row and 23 columns that have WindDirDegrees greater than and equal to 350 and less than equal to 10.</p><p><strong>Task 2. </strong>write code to get and display all the rows in the dataframe that are beween 1 April 2014 and 11 April 2014.</p><p>For this solution, I have already changed the GMT column to datetime using pd.to_datetime and have changed the index to GMT column.</p><pre>#changing date &#39;GMT&#39; to date data type<br><br>london[&#39;GMT&#39;]=pd.to_datetime(london[&#39;GMT&#39;])<br><br>#changing the index to GMT column<br>london.index = london[&#39;GMT&#39;]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Bjeob3XRQAF6CkAHJ1uVQ.png" /></figure><p>For this solution, I saved london[‘GMT’] in a variable called dates. I then created a variable called start and assign date of 2014–4–1 to it. I also created the end variable assigning 2014–4–11 to it.</p><p>I then filtered rows that are between the start and end date.</p><p><strong>Task3.</strong> write two lines of code to display the first five rows that have a missing value in the &#39;Max Gust SpeedKm/h&#39;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w0Mbco_dhLebPt08oB7Qsg.png" /></figure><p>For this solution I filtered out the null and used the head() function to find the first 5 rows that are missing in the &#39;Max Gust SpeedKm/h&#39; column.</p><p><strong>Task 4. </strong>write code to plot the minimum, mean, and maximum temperature during 2014 in London.</p><pre>#1. write code to plot the minimum, mean, and maximum temperature during 2014 in London.<br>london[[&#39;Min TemperatureC&#39;,&#39;Mean TemperatureC&#39;,&#39;Max TemperatureC&#39;]].plot(grid=True, figsize=(10,5))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*n_xg4TzI34uNAilBdFSUkw.png" /><figcaption>minimum, mean, and maximum temperature during 2014 in London.</figcaption></figure><p>Using matplotlib plot (), I plotted a line chart for the minimum, mean, and maximum temperature during 2014 in London.</p><p><strong>Task 5. </strong>plot the values of &#39;Mean Humidity&#39; during spring (full months of March, April and May).</p><pre>#plot the values of &#39;Mean Humidity&#39; during spring (full months of March, April and May<br>london[&#39;Mean Humidity&#39;].loc[datetime(2014,3,1): datetime(2014,5,31)].plot(grid=True, figsize=(10,5),xlabel=&#39;GMT&#39;,ylabel=&#39;Mean Humidity&#39;,title=&#39;Mean Humidity Between March and June&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*pWox0DOyzeRbaJqjrxgH1Q.png" /></figure><p>Using loc function, I selected date from March to May and plotted it in a line chart.</p><h4><strong>PROJECT: Holiday weather</strong></h4><p><strong>#Getting the data?</strong></p><p>I got the data from the <a href="http://www.wunderground.com/history">http://www.wunderground.com/history</a> website</p><p><strong>#Data collection.</strong></p><p>I copied and pasted the 2023 weather data from January to December on my notebook app, I did some arranging and converted it to a csv file.</p><p><strong>#Loading the dataset on my python notebook</strong></p><pre>#reading the data<br>london_2023=pd.read_csv(&#39;london_weather_2023.csv&#39;)<br><br>#printing the first 5 row<br>london_2023.head()</pre><p><strong>#Data Cleaning.</strong></p><pre>london_2023.info()<br>#there are no null values in tha data set<br>#the data types are correct except for date</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bM_3ucho7GVAsUR0paVoqw.png" /></figure><p>I changed the Date column from str to an interger data type.</p><pre>#changing the Date column to date<br>london_2023[&#39;Date&#39;]=pd.to_datetime(london_2023[&#39;Date&#39;])<br><br>print(london_2023[&#39;Date&#39;].dtypes)</pre><p>I also checked for duplicates and there was no duplicates</p><pre>#cheacking for duplicates<br>london_2023.duplicated().sum()<br><br>#output<br>#np.int64(0)</pre><p>I checked for null values in the london_2023 data set and there were none.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dJPqNaeq1wHtSd1ldHOIog.png" /></figure><p>I also made the Date column the index of london_2023</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fI8iyInXvGykPLkvAJOa8Q.png" /></figure><pre>#data transformation<br>#plotting a scatter plot to find if there is a correlation between Temperature (C) Max and Humidity (%) Max<br><br>london_2023.plot(x=&#39;Temperature (C) Max&#39;,y=&#39;Humidity (%) Max&#39;,kind=&#39;scatter&#39;, gid=True, figsize=(10,5</pre><p>I plotted a scatter cahrt to see if there is any correlation between ‘Temperature © Max’ and ‘Humidity (%) Max’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*8HDFnLfPMM6SSNCaaW03XQ.png" /><figcaption>The Scatter Chart between Temperature © Max and Humidity (%) Max</figcaption></figure><p>The correlation -0.140 is statistically significant</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6KLJQh7oK1kkG3VwTzsxaQ.png" /></figure><p># According to meteorologists, summer extends for the whole months of June, July, and August in the northern hemisphere and the whole months of December, January, and February in the southern hemisphere. So create a dataframe that holds just those months using the `datetime` index.</p><pre>from datetime import datetime<br>#I have already made the date column as the index<br>london_2023.index=london_2023[&#39;Date&#39;]<br>london_2023=london_2023.sort_index()<br><br>northern_hemisphere=london_2023.loc[datetime(2023,6,1):datetime(2023,8,31)]<br>northern_hemisphere.head()For the solution to the above question, </pre><ul><li>I imported datetime.</li><li>I change the london_2023 index to the date column</li><li>I created a variable called northern_hemisphere and filter based on date from June to August using loc</li></ul><pre>#creating time column for january to febuary<br>jan_feb=london_2023.loc[datetime(2023,1,31):datetime(2023,2,28)]<br>#creating time column for december<br>dec=london_2023.loc[datetime(2023,12,1):datetime(2023,12,31)]<br><br>#concatenating jan_feb column with dec column<br>southern_hemisphere=pd.concat([jan_feb,dec])<br>#printing the last element of southern_hemisphere<br>southern_hemisphere.tail()</pre><p>The solution for this sourthern hemishere really confused me alot as I was using loc to get from december to jan and feb and the result was an empty table.</p><p>So what I did was to use loc to select data from January to February and stored it in a ‘jan_feb’ variable name and did the same for December storing it a ‘dec’ variable</p><p>I concantenate ‘jan_feb’ and ‘dec’ and stored it in a southern_hemisphere.</p><p>I printed the 5 last element of the southern_hemisphere.</p><h3><strong>Personal Project Assessment</strong></h3><h4><strong>Question</strong></h4><p>Create a completely new project and choose another two of the hundreds of World Bank indicators and see if there is any correlation between them. If there is a choice of similar indicators, choose one that leads to meaningful comparisons between countries.</p><p>After doing the task for <strong>GDP and life expectancy project, </strong>I was given an assessment to chose two data set from world bank indicators and find any correlation between them.</p><p>I chose to analyse <strong>Suicide VS Unemployment(</strong>whether sucide rate was as a result of unemployment)</p><pre>#INDICATORS<br>SUICIDE_INDICATOR= &#39;SH.STA.SUIC.P5&#39;<br>UNEMPLOYMENT_INDICATOR=&#39;SL.UEM.TOTL.ZS&#39;</pre><p>step 1: I got the indicators from world bank and stored it in a variable SUICIDE_INDICATOR and UNEMPLOYMENT_INDICATOR.</p><pre>#getting data from world bank website<br>YEAR=2020<br>from pandas_datareader.wb import download<br>suicideWB=download(indicator=SUICIDE_INDICATOR,country=&#39;all&#39;, start=YEAR, end=YEAR)<br>unemploymentWB=download(indicator=UNEMPLOYMENT_INDICATOR,country=&#39;all&#39;, start=YEAR,end=YEAR)<br>unemploymentWB.head()</pre><p>step2: Using pandas_datareader library, I got the data set from world bank website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PgM0nvVJbt0MnjxeRVEYLg.png" /></figure><p>step 3: I reset the index of the tables and stored it in sucideReset and unemploymentReset variables.</p><pre>#Reseting index for sucideWB and unemploymentWB<br>suicideReset=suicideWB.reset_index()<br>unemploymentReset=unemploymentWB.reset_index()</pre><p>Step 4: from index 0 to index 48 are not countries but group of countries so I used the loc function to select rows from index 49 and stored it in sucideCountries and unemploymentCountries variables.</p><pre>#cleaning the data. <br>#The index from 0 to 48 contains group of data, I will filter and drop null from the table<br>suicideCountries=suicideReset[49:]<br>unemploymentCountries=unemploymentReset[49:]<br>unemploymentCountries.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuewiBipF2KQhcq_NO5TyA.png" /></figure><p>Step 5: I dropped null values from suicideCountries and unemploymentCountries</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WRGLI-5pDLzHswfIJLZ1Sg.png" /></figure><p>Step 6: I converted suicideData[‘SH.STA.SUIC.P5’] &amp; unemploymentData[‘SL.UEM.TOTL.ZS’] to float data type</p><pre># Convert SH.STA.SUIC.P5 column to floats <br>suicideData[&#39;SH.STA.SUIC.P5&#39;] = suicideData[&#39;SH.STA.SUIC.P5&#39;].astype(&#39;float64&#39;)<br><br># Convert SL.UEM.TOTL.ZS column to floats )<br>unemploymentData[&#39;SL.UEM.TOTL.ZS&#39;] = unemploymentData[&#39;SL.UEM.TOTL.ZS&#39;].astype(&#39;float64&#39;)</pre><p>Step 7: I removed the year column leaving the country, sucide_indicator and unemployment indicator.</p><pre>#discarding the year column<br>COUNTRY=&#39;country&#39;<br>headings=[COUNTRY,SUCIDE_INDICATOR]<br>suicideClean=suicideData[headings]<br><br>headings=[COUNTRY,UNEMPLOYMENT_INDICATOR]<br>unemploymentClean=unemploymentData[headings]</pre><p>Step 8: I merge both tables suicideClean and unemploymentClean using inner join.</p><pre>#Merging sucideData with unemploymentData<br>suicideVSunemployment=pd.merge(suicideClean,unemploymentClean,on=&#39;country&#39;,how=&#39;inner&#39;)<br>suicideVSunemployment.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZVkAsOkbEFVZcfCBCgVVFw.png" /></figure><p>Step 7:Here, I was renaming the columns Sucide_Rate and Unemployment_Rate and removed the other columns that I did not need.</p><pre>#removing the original columns<br>SUICIDE=&#39;Suicide_Rate&#39;<br>column=suicideVSunemployment[SUICIDE_INDICATOR]<br>suicideVSunemployment[SUICIDE]=column<br>suicideVSunemployment.head()<br><br>#removing the original columns<br>UNEMPLOYMENT=&#39;Umemployment_Rate&#39;<br>headings=suicideVSunemployment[UNEMPLOYMENT_INDICATOR]<br>suicideVSunemployment[UNEMPLOYMENT] = headings.round(2)<br>suicideVSunemployment.head()<br><br>suicideVSunemployment=suicideVSunemployment[[COUNTRY,SUICIDE,UNEMPLOYMENT]]<br>suicideVSunemployment.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hUreBxtw4EfuE0cAXfagQA.png" /></figure><p>Step 8: in this step, I calculated the correlation and pValue between suicide and unemployment. There was a negative/ inverse correlation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*654yvpCSQ8rVJ4YB0LdLLQ.png" /></figure><p>Step 9: Plotting a scatter chart to show correlation.</p><pre>#plotting suicideVSunemployment in a scatter plot<br><br>suicideVSunemployment.plot(x=SUICIDE, y=UNEMPLOYMENT, grid=True, kind=&#39;scatter&#39;, title=&#39;Suicide_Rate Vs Unemployment&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*sCtgMRF9AjE9t_sPlsWEhQ.png" /></figure><h3><strong>Findings</strong></h3><p>Based on the scatter plot, there is no strong linear correlation between the Suicide Rate and the Unemployment Rate. The data points are highly scattered, indicating that changes in one variable do not predictably follow changes in the other.</p><h3><strong>SQL Practice</strong></h3><p>I also worked on some SQL tasks.</p><ul><li>One of the task required that I removed the &lt;br /&gt; tag from WindDirDegrees&lt;br /&gt; and convert the column to string and count the days when the wind direction was greater than 350 degrees.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wYdtIya7Xc_5Rvl-Uc31kQ.png" /></figure><p>I counted all the rows as Days_Greater_than_350. I also changed the data type of WindDirDegrees&lt;br /&gt; to interger and filtered the WindDirDegrees&lt;br /&gt; column with number greater than 350.</p><ul><li>Another task I worked on was to Convert the ‘GMT’ column to a real date and return London’s weather for 8–12 December 2014. The task required me to return Max TemperatureC and Min Temperature C and sort the columns by day.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1gqscK8omBRLNXpXlWN-nA.png" /></figure><p>I use the TRY_CONVERT() to convert the date column ‘GMT’ to date and alias it as ‘day’, I also selected the ‘Max TemperatureC’ and ‘Min Temperature C’ column from the week07.london_2014 table and filtered ‘GMT’ between 8th of December to 12th of December than sort by ‘day’.</p><h3><strong>Challenges Faced</strong></h3><p>One of the challenges I faced this week was getting the London weather data from the underground weather website because I could not download the the data as a csv. Also, there was no way to get 1 full year weather data from the website. The only option was to copy data monthly and paste it on my notebook. I have to arrange the data and save it as a Csv file.</p><h3><strong>Conclusion</strong></h3><p>This week was Interesting and my Learning journey also continues. See you next week!</p><p>Can’t wait to tell you all I have learnt!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f7cb64504ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WEEK 6:All About Numpy, Pandas and Sql.]]></title>
            <link>https://medium.com/@preciousnwachukwu067/week-6-all-about-numpy-pandas-and-sql-94d6937c72f1?source=rss-c2a9b2a4dec5------2</link>
            <guid isPermaLink="false">https://medium.com/p/94d6937c72f1</guid>
            <dc:creator><![CDATA[Chinenye Precious Nwachukwu]]></dc:creator>
            <pubDate>Sun, 18 Oct 2026 19:12:35 GMT</pubDate>
            <atom:updated>2026-10-18T19:12:35.211Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HXPOnKoRZ9C-LN5zCNf-ew.jpeg" /></figure><h3><strong>Introduction:</strong></h3><p>Week 6 of my internship with dataraflow took me into NumPy, pandas and sql intermediate. I won’t lie, this week have really challenged me in different way as there were a lot to learn, understand and practice.</p><p>The most interesting part for me was working with sql database in python as I had to connect to dataraflow database to work work with the data. The SQL learning took most of my time because there were many concepts to understand and practise.</p><p>Let’s dive in!</p><p><strong>NUMPY</strong></p><p><strong><em>What I learnt in NumPy</em></strong></p><p>I learnt that numpy is a python library and is used to work with array. NumPy actually stands for <strong><em>Numerical Python</em></strong>.</p><p>Although python have traditional list which is used to work with array, I discovered that NumPy is much preferred than the traditional python array becausebecause they can process large amounts of data more efficiently.</p><p>It was also interesting to know that NumPy was written in <strong><em>C or C++ and partially in python</em></strong><em>.</em></p><p>I learnt that to install NumPy, I needed have to had installed python or pip which I have already installed on my system during the introduction of python taught in week 2 of my internship.</p><p>To install NumPy in my system I ran this command on my command prompt. Your can also install this in power shell or your code editor’s terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*6-Z_6f9ssPQSp6pPTw12Qg.png" /></figure><p>I then imported NumPy in my note book with an alias ‘np’ which the usually way of importing NumPy.</p><pre>import numpy as np</pre><p><strong><em>Creating and Working with NumPy array</em></strong></p><p>I learnt that we use array() function to create Numpy ndarray object . You can pass list,tuple and any array-like object into np.array() method to create NumPy Array.</p><p>Example: lets create a Numpy array using tuple:</p><p><strong><em>Step 1</em></strong>: I will import the numpy library</p><pre>import numpy as np</pre><p><strong><em>Step 2:</em></strong> Create my array using np.array()</p><pre>num =(1,2,3,4,5,6,7,8,9,10)<br>arr=np.array(num)<br></pre><p><strong><em>Step 3: </em></strong>Print array and the data type</p><pre>print(arr)<br>print(arr.dtype)</pre><pre>#output<br>[ 1  2  3  4  5  6  7  8  9 10]<br>int64</pre><h3><strong>Dimensions In Arrays</strong></h3><p>This topic really confused me, as I was really trying to understand it as best as I could. When learning this topic, in my mind I was like what is the purpose of creating dimension array? Beacause I did not see any use of it but I later began to understand their importance. I got to learn that it mostly used to represent matrices which I learnt when I was in secondary school.</p><p><strong><em>What is dimension in arrays</em></strong></p><p>Dimension in array is one level of array depth(nested arrays).</p><p>To check for the number of dimension in an array we use <strong>ndim.</strong></p><p><strong>0-D array or scalars(Zero-Dimensional)</strong>: contains only one value.</p><p>For Example:</p><pre>import numpy as np<br>arr= np.array(90)<br>print(arr)<br>print(&#39;number of dimension&#39;,arr.ndim)<br><br>#output<br>90<br>number of dimension 0</pre><p>In this example above: arr.ndim return 0 because it is a zero dimension array.</p><p><strong>One Dimensional Array(1-D Arrays): </strong>this contains elements arranged in a single axis.</p><p>For example:</p><pre>import numpy as np<br>arr= np.array([1,2,3,4,5])<br>print(arr)<br>print(&#39;number of dimension:&#39;,arr.ndim)<br><br>#output<br>[1 2 3 4 5]<br>number of dimension: 1</pre><p><strong>Two-Dimensional Array(2-D array)</strong>: These are array are used to represent matrices or 2nd order tensors. It arranges element along two axis: rows and columns.</p><pre>import numpy as np<br>arr= np.array([[1,2,3,4,5],[6,7,8,9,10]])<br>print(arr)<br>print(&#39;number of dimension:&#39;,arr.ndim)<br><br>#output<br>[[ 1  2  3  4  5]<br> [ 6  7  8  9 10]]<br>number of dimension: 2</pre><p><strong>Three-Dimensional Array(3-D array):</strong>These are array are used to represent matrices or 3rd order tensors. It contains two-dimensional array arranged along a third axis.</p><p>For Example:</p><pre>import numpy as np<br>arr= np.array([[[1,2,3],[4,5,6]],[[7,8,9],[10,11,12]]])<br>print(arr)<br>print(&#39;number of dimension:&#39;,arr.ndim)<br><br>#output<br>[[[ 1  2  3]<br>  [ 4  5  6]]<br><br> [[ 7  8  9]<br>  [10 11 12]]]<br>number of dimension: 3</pre><p>I also learnt that an array can have any number of dimension. You can define the number of dimension of array with <strong><em>ndmin</em></strong> argument.</p><p>For Example: I will create a 6 dimensional array with ndmin augument.</p><pre>import numpy as np<br>arr= np.array([1,2,3,4,5], ndmin=6)<br>print(arr)<br>print(&#39;number of dimension:&#39;,arr.ndim)<br><br>#output<br>[[[[[[1 2 3 4 5]]]]]]<br>number of dimension: 6</pre><p><strong><em>Accessing Arrays</em></strong></p><p>numpy array element can be accessed using there index number and index number starts with 0.</p><p><strong><em>Accessing the first element of a 1-D array.</em></strong></p><pre>import numpy as np<br>arr= np.array([1,2,3,4,5])<br>print(arr[0])<br><br>#Output<br>1</pre><p>Accessing the second element of the second colum in a 2-D array.</p><pre>import numpy as np<br>arr= np.array([[1,2,3,4,5],[6,7,8,9,10]])<br>print(arr[1,1])<br><br>#output<br>7</pre><p>where [1- accessing the second column, 1- accessing the second element].</p><p><strong><em>Slicing Array</em></strong></p><p>I learnt about slicing array. To slice array we use this format[start:end]. The<em> step</em> can also be added:[start:end:step].</p><p>For example: I will slice the below array from index 1 to index 5.</p><pre>import numpy as np<br>arr= np.array([1,2,3,4,5,6,7,8,9,10])<br>print(arr[1:5])<br><br>#output<br>[2 3 4 5]</pre><h3><strong><em>Copy and View</em></strong></h3><p>I learnt about the difference between copy and view of an array.</p><p><em>A copy is a new array and changes made to a copy do not affect the orignal data and vice versa</em></p><p><em>while</em></p><p><em>view is just like the original array. Any changes made in the view will also affect the the original array and vice versa.</em></p><p>To check if an array is a copy or view, we use the <strong>base attribute.</strong></p><h3><strong><em>Searching Array</em></strong></h3><p>I learnt about the where() method which is used to search an array. For example:</p><pre>import numpy as np<br>arr= np.array([1,2,3,4,5,6,7,8,9,10])<br>a=np.where(arr == 9)<br>print(a)<br>#output<br>(array([8]),)</pre><h3><strong>Sorting Array</strong></h3><p>To sort array we use the sort() function and this method returns a function.</p><pre>import numpy as np<br>arr= np.array([90,78,23,60,44,53,12,81,33,45])<br>a=np.sort(arr)<br>print(a)<br>#output<br>[12 23 33 44 45 53 60 78 81 90]</pre><p>The sort() method arranged the array numerically from ascending to decending. The sort method also works for string array and booleans.</p><p>Theses are little of what I learnt this week in numpy as I also learnt how to reshape array using the reshape() method. I also learnt about joining and spliting array. I learnt about Iterating array using the for loop and nditer() method e.t.c.</p><h3><strong>Tasks I worked on</strong></h3><p>One of the task i was given was to write a numpy program to test element-wise for NAN of a given array. In this task i learnt how to identify NAN values in numpy array. NaN means “not a number” which means the value is undefined or missing.</p><p><strong>first step: </strong>I imported numpy</p><p><strong>second step:</strong> I created a numpy array</p><p><strong>third step: I </strong>used a for loop to iterated the array to check NaN values.</p><p>step 4: I checked all elements at once using np.isnan</p><pre>#1.Write a NumPy program to test element-wise for NaN of a given array.<br><br>num =np.array([1, 2, np.nan, 4, 5, np.nan])<br>for x in num:<br>    if np.isnan(x):<br>        print(f&quot;{x} is NaN&quot;)<br>    else:<br>        print(f&quot;{x} is not NaN&quot;)<br>#Element-wise test: True where an element is NaN<br>print(num)<br>print(np.isnan(num))<br><br>#Output<br>2 is not NaN<br>nan is NaN<br>4 is not NaN<br>5 is not NaN<br>nan is NaN<br>[1, 2, nan, 4, 5, nan]<br>[False False  True False False  True]</pre><p>Another task I worked on was to write a NumPy program to test element-wise for complex number, real number of a given array. Also test whether a given number is a scalar type or not.</p><p><strong>Step 1</strong>:Import NumPy</p><p>import numpy as np</p><p><strong>Step 2: </strong>Create an array</p><p>num = [5, 2, 7j, 3+4j, 6.5, 8]</p><p><strong>Step 3:</strong>Test for complex and real numbers</p><p><strong>Step 4: </strong>Step 4: Check whether a value is a scalar</p><p>How I solved this task was to first import numpy. I then created an array with complex numbers, intergers and float number. Then using iscomplex() and isreal() number i checked if the array is a complex or real number. I also checked if a number is scaler using the method .isscalar()</p><pre>import numpy as np<br>num=[5,2,7j, 3+4j, 6.5, 8]<br>#Element-wise test: True where an element is complex number,real number<br>complex_test = np.iscomplex(num)<br>real_test = np.isreal(num)<br><br>print(f&quot;Array: {num}&quot;)<br>print(f&quot;Complex test: {complex_test}&quot;)<br>print(f&quot;Real test: {real_test}&quot;)<br><br>#check if a given number is a scalar type or not<br>num=21<br>scalar_test = np.isscalar(num)<br>print(f&quot;Scalar test: {scalar_test}&quot;)</pre><p><strong>Output</strong></p><p>Array: [5, 2, 7j, (3+4j), 6.5, 8]</p><p>Complex test: [False False True True False False]</p><p>Real test: [ True True False False True True]</p><p>Scalar test: True</p><h3><strong>Pandas</strong></h3><p>In this week internship,Ii learnt also learnt about pandas in data analysis. Pandas provides data structure for series,dataframes and panels. It is an open source data analysis and manipulation tool.</p><h4>Task I worked on in Pandas</h4><p>I worked on some of questions asked on python pandas. But first I connected the dataraflow database to my python so I can answer the questions. The questions includes:</p><pre>#connecting the database<br>data = run_query(&quot;SELECT * FROM week06.who_pop_tb_some&quot;)<br>data</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VVotrkD4q3TU-MkXTbzjUQ.png" /></figure><ol><li><strong>What is the total, smallest, largest, and average number of deaths due to TB?</strong></li></ol><p><strong>Answer</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OyA6l2aP3etDe-DlVf5d8w.png" /><figcaption><strong>Question: What is the total, smallest, largest, and average number of deaths due to TB?</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gDlJUeCTGEGgNQtDl4nstA.png" /><figcaption><strong>Question: What is the average number of deaths due to TB?</strong></figcaption></figure><p>2. <strong>What is the death rate (number of deaths divided by population) of each country?</strong></p><p><strong>Answer</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*crtDr537hS628UiqZ3IlvA.png" /></figure><p>I learnt how to select column using pandas, sort_values() to arrange dataframe ascending and descending, using the head() method to get the first 5 row or whatever number you specify the head() method to retrieve and the tail() method to retrieve the last 5 numbers.</p><p>In my assignment, we were given a task to<em> “write a Python program to create and display a one-dimensional array-like object containing an array of data using Pandas module.”</em></p><pre>#1. Write a Python program to create and display a one-dimensional <br># array-like object containing an array of data using Pandas module.<br><br>#import pandas<br><br>import pandas as pd<br><br>#crete a one dimensional array<br>array_series= pd.Series([1,2,3,4,5,6,7,8,9])<br>#print array_series<br>print(array_series)</pre><p>In the above, I imported pandas as pd and created an array using pandas Series and printed te array_series.</p><p><strong>Output</strong></p><pre>0    1<br>1    2<br>2    3<br>3    4<br>4    5<br>5    6<br>6    7<br>7    8<br>8    9<br>dtype: int64</pre><h3><strong>Structured Query Language</strong></h3><p>I said this week challenged me in so many way, Sql was a whole lot of the reason. From challenge of connecting my code editor to the dataraflow database to information_schema to queryin tables and columns with case expressions,group by,having,count,joins,subquery,common table expression(ctes), null,coalesece e.t.c</p><p>One major thing I was having challenges is I was trying to understand the data within tables and columns because if I do not understand the table and columns answering question from the table will be really hard for me.</p><p>This week I learnt about Information_Schema. I learnt that on the first day of work if I have been given a database I have not seen, before analysing the, I should ask myself 3 question:</p><ol><li>what tables exist in the database?</li><li>what columns do they have?</li><li>what does the data actually look like?</li></ol><p>Using Information Schema help me answer these question and to understand the data well and what is required of me.</p><p>Profiling your table using count, sum, min, max is a good habit to finding distinct number, missing values etc.</p><h3><strong>Task I Worked on in SQL</strong></h3><ol><li>The first task: Using INFORMATION_SCHEMA.COLUMNS, list every table in the week06 schema with how many columns it has.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MiB3uC5P-e8R0l8cZ_R_eA.png" /><figcaption>INFORMATION_SCHEMA.COLUMNS</figcaption></figure><p>I selected TABLE_NAME, count column name to get the total number of columns. from INFORMATION_SCHEMA.COLUMNS. I filtered the table using where to get on TABLE_SCHEMA of week06. I grouped and order the query by the Table name.</p><p>2. The second task was on filtering and using null. The task was to examine London’s weather data for 2014 in the table week06.london_2014 and return one row containing three counts. I was tasked to find</p><p>a. no_event_days: days with no event recorded</p><p>b. rain_days: days whose event mentions Rain anywhere(using LIKE keyword)</p><p>c. wet_but_no_event_days: days with no event recorded but Precipitationmm &gt; 0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QWjUy_ajRV1joLhupF8ZkA.png" /></figure><p><strong>How I went about this task</strong></p><p>a. I first of used the sum aggegation function and the case expression to find the total number of ‘ Event’ that were null and alias it using the ‘AS’ key word.</p><p>b. For the second in the select statement, I used the sum aggregation function and the case key word to get the total number from the [ Event] column that contains rain anywhere.</p><p>c. For the third statement in the select clause I also used sum() function and case expression to get the total of [ Events] that IS NULL and Precipitationmm greater than zero from week06.london_2014 table.</p><p>3. The third task: I have to From week16.customer_churn_prediction, find the number of customers, number of churn and churn_rate_pct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*srcRZ4858vZ-cj2Q9T5YSQ.png" /></figure><ol><li>I selected Contract_Type, Count(*) as the number of customer, using sum and case expression, i calculated the total number of churn as churned, i also calculated the churn_rate_pct from week16.customer_churn_prediction table.</li><li>I grouped by Contract_Type</li><li>I ordered the query by churn_rate_pct ascending order.</li></ol><h3><strong>Challenges I faced</strong></h3><p>I faced lots of challenges during the week which includes:</p><ol><li>There was a lot to learn with limited time. I had to sacriface lots of time to understand and practice.</li><li>Understanding the different tables Involved. There were alot of tables to query at the same time and I got so confused. As a result, querying the database to extract answers was hard as I do not know what to look at. But using the INFORMATION_SCEMA made it a little bit easier.</li></ol><h3><strong>Conclusion</strong></h3><p>As the week goes by, the topics keeps on getting complex and challenging but I will conquer.</p><p>week 7 here I come…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94d6937c72f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 4 & 5:Research writing]]></title>
            <link>https://medium.com/@preciousnwachukwu067/week-4-5-research-writing-a7257080f857?source=rss-c2a9b2a4dec5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7257080f857</guid>
            <dc:creator><![CDATA[Chinenye Precious Nwachukwu]]></dc:creator>
            <pubDate>Sun, 11 Oct 2026 19:43:07 GMT</pubDate>
            <atom:updated>2026-10-12T20:14:52.701Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*KwwZ-jUTLRsSZTIPpzAKpQ.jpeg" /></figure><p>Weeks four and five of my DataraFlow internship have really been challenging for me. For these two (4 &amp;5) weeks we focused on research writing.</p><p>There was a lot to do from finding a research topic to drafting a research proposal.<br>Since my background is in accounting, I wanted to find a research topic that relates to my domain. I browsed online, read through different materials, and kept searching until I found a topic that I spiked my interest.<br>But finding a research topic I was interested in wasn’t enough as the topic has already been written by so many authors but I had to identify a research gap different from what others have written.</p><p>I went back and forth, trying to understand what had been done and what research gap I can fill.</p><p>During my search for a topic I came across a research topic that focused on &#39;predicting financial distress in companies using structured financial statements.’ Then I asked myself what about small businesses that don’t maintain formal financial statements and rely mainly on informal financial records, such as sales and expense logs?</p><p>Can informal financial records be used to predict distress in small businesses who do not keep a structured financial statement?</p><p>That really spiked my interest and there I decided on what my research topic will be.<br>My research topic is &quot;Beyond the Financial Statements: Predicting Financial Distress in small businesses Using Informal Transaction Data&quot;</p><p>Then came the main work, drafting my research proposal. Drafting my research proposal really confused and challenged me as I was exposed to lots of technical jargons that I am understanding and some yet to understand. But I know that as I advance in my data science internship I will understand more practically.</p><p>These two weeks was an eye opener that there is a lot to research writing far beyond what I already know.</p><p>I don’t have it all figured out completely now but I know I am getting there little by little.</p><p>still learning,still growing.</p><p>see you next week.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7257080f857" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 3:My Learning Journey so far…]]></title>
            <link>https://medium.com/@preciousnwachukwu067/week-3-my-learning-journey-so-far-623bdbca4383?source=rss-c2a9b2a4dec5------2</link>
            <guid isPermaLink="false">https://medium.com/p/623bdbca4383</guid>
            <dc:creator><![CDATA[Chinenye Precious Nwachukwu]]></dc:creator>
            <pubDate>Sun, 27 Sep 2026 17:10:55 GMT</pubDate>
            <atom:updated>2026-09-27T17:10:55.169Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Week 3 took us into modules, date, math, pip, virtual environment, how to read and write files and the introduction to SQL.</p><h4><strong>MODULES</strong></h4><p>I learnt that module is a Python file that contains reusable code, such as functions, variables, and classes.</p><p><strong><em>Creating a module</em></strong><br>To create a module, you create a python file and name it. For example creating a precious.py file and save it with the .py extension for python.</p><p>Inside my precious.py file I can now write my function:</p><pre>def greet_precious():<br>        print(&#39;Hello everyone,my name is Precious&#39;)</pre><p>You can the use this module created in any python file<br>By importing the module into the python file you want to use the module in.</p><p><strong><em>importing precious module into a python file</em></strong></p><pre>import precious<br>#Calling the function in precious.py<br>greet_precious()</pre><p>You can also import the greet function directly</p><pre>from precious import greet_precious<br>greet_precious()</pre><p>There are also inbuilt modules like platform, date, time, math etc. which you can also import and use in your code.</p><h3><strong>Date</strong></h3><p>I learnt that the date time module function is used best when you are working with date and time in your code. It is an inbuilt module that is imported in python.</p><pre>Import datetime<br>#getting today&#39;s date<br>today=datetime.datetime.now()<br>#getting current year using date time<br>current _year=today.year<br>#getting current month using date time<br>current _month=today.month<br>#getting current day using date time<br>current _day=today.day<br>#printing today, current _year,current_month, current_day<br>print(today)<br>print(current_year)<br>print(current_month)<br>print(current_day)</pre><h3><strong><em>An Inbuilt function called math</em></strong></h3><p><strong><em>math</em></strong><em> </em>is a function that can be used to perform mathematical operations in python.</p><p>Functions math has:<br><a href="http://math.max/">math.max</a>()-to get the highest number<br><a href="http://math.min/">math.min</a>()- to get the min number<br><a href="http://math.sqrt/">math.sqrt</a>() -to get the square root of a number<br><a href="http://math.ceil/">math.ceil</a>()-to round up a number<br><a href="http://math.floor/">math.floor</a>()- to round down a number. etc.</p><pre>#example of using math fumction<br>import math<br>number= [56,25,95,54,36]<br>print(math.max(number)<br><br>#output: 95</pre><h3><strong><em>Learning and understanding JAVASCRIPT OBJECT NOTION(JSON)</em></strong></h3><p><strong><em>JSON</em></strong> is used in storing and exchanging data. <strong><em>JSON</em></strong> helps python to work with JSON data. JSON has to be imported when you want to use it<br>import json.<br><strong><em>Converting JSON to python dictionary.</em></strong><br>To convert JSON data to python dictionary we can use:</p><p>json<a href="http://json.loads/">.loads</a>()<br>For example:</p><pre>#creating a JSON data<br>import json<br>person=&#39;{<br>&quot;name&quot;:&quot;Precious&quot;,<br>&quot;age&quot;:48<br>}&#39;<br>#converting JSON data to python dictionary<br>print(JSON.loads(person)</pre><p><strong><em>Converting python dictionary to JSON<br></em></strong>To convert a python string to JSON we use <a href="http://json.dumps/">JSON.dumps</a>().</p><pre>import json<br>#Creating python dictionary<br>person={<br>&quot;name&quot;:&quot;Precious&quot;,<br>&quot;age&quot;:48<br>}<br>#converting a python dictionary to JSON<br>print(JSON.dumps(person))</pre><p>String,int,True,False,list,dictionary,tuples,float and none can be changed to <em>JSON</em> strings and they are changed to to their JSON equivalent.<br><em>Dictionary </em>are changed to <em>Object</em>,<br><em>Tuples</em> are changed to <em>Array</em>,<br><em>List </em>are converted to <em>Array</em>,<br><em>str</em> converted to <em>String</em><br><em>int </em>and<em> float</em> are converted to Number<br><em>True </em>and <em>False</em> are converted to <em>true</em> and <em>false</em>. <em>none </em>will be converted <em>null</em>.</p><h3><strong>Pip and Virtual Environment</strong></h3><p>I learnt about <strong><em>pip</em></strong> which is a package manger that can be used to install packages in python.<br>To install a package in python we will need to download pip.<br><strong><em>Downloading a package with pip</em></strong><br>After downloading pip, we can install a package we want for example, if I want to install numpy on my python I will have to run this command:</p><pre>pip install numpy</pre><p>To use the numpy downloaded we will have to import the package:<br><em>import numpy</em><br><strong><em>Removing Package</em></strong><br>To remove the numpy I downloaded in python we can run this code:<br><em>pip uninstall numpy</em></p><h3><strong>Python User Input</strong></h3><p>Python user input enable coders to ask for user input through the inbuilt <strong><em>input()</em></strong> method in python. For example:</p><pre>#creating an input that as for user name:<br>name= input(&#39;What is your name&#39;)<br>print(f&#39;Your name is {name}&#39;)<br>#output<br>#name=&#39;Precious&#39;<br>#Your name is Precious</pre><h3><strong>Virtual Environment</strong></h3><p>I learnt about Virtual environment and in python, it is an isolated environment on your computer where you can run and test your python projects.<br>In my assignments this week, one of the tasks was to create and document my steps for creating a virtual environment, activating the virtual environment. I was also tasked to install numpy in the virtual environment created, verify the numpy installation and show the output of pip list.</p><p><em>Below is my step process in doing the task.</em></p><ol><li>I opened command prompt on my computer</li><li>I navigated to where i wanted to create my virtual environment “C:\Users\USER\Documents\Dataraflow” by using cd “C:\Users\USER\Documents\Dataraflow”</li><li>creating the virtal environment I ran this on my command prompt — python -m venv myvirtualenv</li><li>Then i activated the virtual enivronment using — myvirtualenv\Scripts\activate 4.Installing numpy in my virtual environment ‘myvirtualenv’ — pip install numpy</li><li>#verifying the installation — pip show numpy</li><li>pip list output numpy 2.5.3 pip 25.2</li></ol><p><strong><em>Results</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*j6DG_taMUI-pHnlY8P5-8w.png" /></figure><h3>Error Handling</h3><p>I learnt how to handle errors and raise exception in python. Python uses try, except, else and finally to handle errors in codes.<br>The try statement is used to test code for error.<br>The except block handles the errors if there are any.<br>The else block execute when there are no error in the code.<br>The finally statement runs regardless of errors. It will always run.<br>In my assessment, we were a given a task to use handle errors in a program that asks the user for a number and divides 100 by that number using try/except.<br>Below was the steps I took.</p><pre>#program that asks the user for a number and divides 100 by that number.<br>#Use try/except to handle invalid input and division by zero.<br>try:<br>    num = float(input(&#39;Write a number!&#39;))<br>    answer= 100/num<br>    print(f&quot;100 divided by {num} is {answer}&quot;)<br>except ValueError:<br>    print(&quot;Invalid Value! Enter a number!&quot;)<br>except ZeroDivisionError:<br>    print(&quot;Zero cannot be divided by any number&quot;)</pre><h3><strong>Read and Write File</strong></h3><p>I learnt how to open a file in python. We use the open() function to open a file which contains two parameters<br>a. <em>filename</em>: Which is the name of the file you want to open<br>b. <em>mode</em>: This is the mode in which the file will be open.</p><p>There are different types of mode: ‘<br>a. ’ r’-opens to read a file<br>b. ’w’-opens a file for writing.<br>c. ’a’-opens a file for appending and if the file does not exist it creates it.<br>d. ’x’-creates a specific file but if file already exists it returns an error.</p><p><strong><em>Opening a file.</em></strong></p><pre>with open(&#39;precious.txt&#39;,&#39;rt&#39;) as f:<br>             print(f.read())</pre><p><strong><em>Closing a file</em></strong></p><p>The one that starts with ‘<em>with</em>’ when opening a file automatically closes the file but without starting with the ‘with’ statement when opening a file, you have to close it after you open the file.</p><pre>f=open(&#39;precious.txt&#39;,&#39;rt&#39;) as f:<br>print(f.read())<br>f.close()</pre><h3>Introduction to SQL(Structured Query Language)</h3><p>I learnt about sql which is used to store, manipulate and store data. It uses relational database and stores data in rows and column. I learnt the different command use to manipulate and retrieve data in a database which includes:</p><ol><li>The <strong><em>select </em></strong>statement: To retrieve specific column and data in a database.</li><li>The <strong><em>where</em></strong> statement: used to filter data.</li><li>The <strong><em>order by</em></strong> statement: used to sort data.</li><li>The <strong><em>group by</em></strong> statement- to summarize data in combination with aggregate function like sum(),avg(), min(),max(),count() e.t.c.</li><li>The <strong><em>join </em></strong>statement: used to join two or more tables.</li><li>The <strong>from</strong> statement: the table you want to retrieve data from.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=623bdbca4383" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object-Oriented Programming: My Week 2 Learning Journey.]]></title>
            <link>https://medium.com/@preciousnwachukwu067/object-oriented-programming-my-week-2-learning-journey-7ca48713aa88?source=rss-c2a9b2a4dec5------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ca48713aa88</guid>
            <dc:creator><![CDATA[Chinenye Precious Nwachukwu]]></dc:creator>
            <pubDate>Sat, 19 Sep 2026 13:13:50 GMT</pubDate>
            <atom:updated>2026-09-19T13:13:50.250Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>Week two of my <strong>dataraflow </strong>internship took me deeper into python and Object-Oriented Programming(oop). At first, the concepts like object, attributes, method, class, __init__, self, inheritance, etc looked so strange and tough but as I dived deeper into understanding these concepts, it became simpler and understandable.</p><h4><strong>Object Oriented Programming</strong></h4><p>First of all, what is Object Oriented Programming?</p><p>Object-Oriented Programming help to structure code using class and object to ensure better organization and code reusability. OOP also applies the DRY principle which means ‘Don’t Repeat Yourself’.</p><h4><strong>Classes and Objects</strong></h4><p><strong>Classes</strong></p><p>I was curious of what classes meant because I first thought it might be similar to students in a classroom. I quickly realized that it was completely different, but the idea of grouping things together is kind of similar.</p><p>In python, ‘A class is a blueprint used for creating objects. It defines the attributes and methods that object created from a class can have.</p><p>For Example: I can create a class called Student.</p><pre>class Student:<br> name =” Precious”<br> age=20<br> hobby=’Learning’</pre><p>In the example, the student is the class while name, age, hobby are the attributes of the class.</p><p>Sometimes, we may want to create a class without defining anything inside it yet. The pass keyword allows us to create an empty class without getting a syntax error.</p><p>For example:</p><pre>class Student:<br>  pass</pre><p>From the example above, I created a class called Student. You can see it is empty. If I run the code like that without the pass keyword. It will produce an error.</p><p><strong>Objects</strong></p><p>Object is an instance of a class. In a clear term, the class is the blueprint while the object is something that is created from that blueprint(class). It is also worthy to note that I can create multiple instances of a class like the example below.</p><p>For example:</p><pre>student1=Student ()<br>student2=Student ()</pre><p>In this example above, student1 and student2 are objects(instances) of the student class.</p><p><strong>__init__()</strong></p><p>This is another very important method I learnt which is used when creating class which is a method that is automatically called when an object is created. The __init__() method is used to give each object its own attributes. The __init__ method allows me to provide students name and age when creating an object.</p><p>For example:</p><pre>class Student:<br> def __init__(self, name, age):<br>  self.name=name<br>  self. age= age<br>#creating instance of the class Student<br>student1=Student (‘Precious’, 21)<br>student2= Student (‘Chinenye’, 22)<br>print(student1.name)<br>print(student1.age)<br>print(student2.name)<br>print(student2.age)</pre><h4><strong>Self Keyword</strong></h4><p>I came across ‘self’ when creating a class in python with the __init__() method. I learnt that the “self parameter is a reference to the current instance of a class and it is used to access the attributies and methods that belong to that particular instance.” It is not a must for it to be called self. It can be called anything but it must be the first parameter.</p><p>For example:</p><pre>class Student:<br> def __init__(self, name, age):<br>  self.name=name<br>  self. age= age<br> def greet(self):<br>  print(f’hello, {self.name. I am {self.age} years old’)<br>student1=Student (‘Precious’, 21)<br>student1.greet()</pre><h4><strong>Inheritance</strong></h4><p>Another thing I learnt this week is inheritance.</p><p>Inheritance simply means when a class inherits the properties and method of another class. The one being inherited from is called the <strong>parent or based class</strong> and the one that is inheriting from another class the <strong>child or the derived class.</strong> One thing I found very interesting is that inheritance helps to avoid redefining the same thing over and over again. If a new class will require some of the properties or method of a class that already exist, it can inherit them rather than creating them again.</p><p>For example:</p><pre># Base class<br>class Student:<br> def __init__(self, name, age):<br>  self.name=name<br>  self. age= age<br> def greet(self):<br>  print(f‘Hello,{self.name}. I am {self.age} years old’)<br><br># Child Class<br>class GraduateStudent(Student):<br> def __init__(self,name,age):<br> Student.__init__(self, name, age)<br> def study(self):<br>  print(f’{self.name} is studying’)<br>student1= GraduateStudent(‘Chinenye’, 39)<br><br>print(student1.greet())<br>print(student2.study())<br><br></pre><p><strong>super() in inheritance</strong></p><p>I also learnt about super keyword. It is a function that helps the child class inherit properties and methods from the parent class without having to parent class name.</p><p>Let us reorganize the child of the Student class graduateStudent using the super.__init__() function.</p><pre>class GraduateStudent(Student):<br> def __init__(self,name,age):<br>super.__init__(self, name, age)<br> def study(self):<br>  Print(f’{self.name} is studying’)<br>student1= GraduateStudent(‘Chinenye’, 39)<br><br>print(student1.greet())<br>print(student2.study())</pre><p>You can see in the above example that we do not need to write the parent class name. We can just write super and the child class will inherit the properties and methods of the parent class.</p><p><strong>Polymorphism</strong></p><p>Another interesting thing I learnt was polymorphism which means creating method that can be executed on many objects and classes with the same. For example, a parent class may have a method and a child element can also have the same method but the content in the method can be different. That is the child element overriding the method content of the parent class.</p><p>One of the task given to me is to create a class Bird(parent class), Parrot(child class) and Crow(child class). They should both have the same method speak() but the content inside each method will be different from that of the parent meaning the children method will override the parent’s method.</p><pre>#base class<br>class Bird:<br>    def __init__(self):<br>        pass<br>    def speak(self):<br>        print(&#39;Chirp&#39;)<br><br>#subclass parrot<br>class Parrot(Bird):<br>    def speak(self):<br>        print(&#39;Squawk&#39;)<br><br>#subclass crow<br>class Crow(Bird):<br>    def speak(self):<br>        print(&#39;Caw&#39;)<br><br>def make_bird_speak(bird):<br>    bird.speak()<br><br>parrot1= Parrot()<br>crow1= Crow()<br><br>make_bird_speak(parrot1)<br>make_bird_speak(crow1)</pre><p>In the above example, the parent class Bird and the child class parrot and crow both have the same method but the children classes provide their own versions of the method.</p><h4><strong>ITERATORS</strong></h4><p>Iterator is another amazing thing I learnt this week. An iterable is an object that can be iterated over, such as a string, list, set, tuple, or dictionary. An iterator is an object that allows us to retrieve these values one at a time.</p><p>Iterators include methods such as __iter__ which helps to iterate through values in a list, set, tuples and dictionary and __next__ which return the next items in a sequence. I also learnt about the <em>StopIteration</em> which is use to prevent iteration for going for ever especially if the data is so much. But honestly, I will prefer using the for loop to iterate through data as it easier and help avoid repetition of the same thing.</p><p><strong>Another of the tasks given I was given to do is to:</strong></p><p>a. Take a list of numbers [10, 20, 30, 40, 50].</p><p>b. Convert it into an iterator using iter () and retrieve each element using next ().</p><p>c. Handle the StopIteration exception gracefully when there are no more items</p><pre>#create a list<br>number=[10,20,30,40,50]<br># iterator<br>myit=iter(number)<br><br># Retrieve each element using next()<br>try:<br>    print(next(myit))<br>    print(next(myit))<br>    print(next(myit))<br>    print(next(myit))<br>    print(next(myit))<br>    print(next(myit)) <br>except StopIteration:<br>    print(&quot;There are no more number.&quot;)</pre><p>In this example, I first created a list called ‘number’. I then used the iter() function to convert the list into an iterator and stored it in a variable called ‘myit’.</p><p>I then used the ‘next()’ function to retrieve each item one at a time. Since the number list contains only five numbers, calling ‘next’ for the sixth time raises a ‘StopIteration’ exception. I handled this using try and except, allowing me to display a message instead of letting the program stop with an error.</p><h4><strong>Scope</strong></h4><p>Scope is an important concept I learnt. It is where variables are only available in the region it is created. There are two types of scope:</p><p>a. Global scope and</p><p>b. Local scope</p><p>Global scopes are variables created on the main body of a code and can be accessed inside and outside a function.</p><p>while</p><p>Local scope is created inside a function and can only be used in that function.</p><p>For Example:</p><pre>x = 300<br>def myfunc():<br>  x = 200<br>  print(x)<br>myfunc()<br>print(x)<br></pre><p>from the example we can see that x= 300 is the global scope while x = 200 is the local scope and we can only access x= 200 only inside the function and not globally.</p><h3><strong>Challenges encountered</strong></h3><ol><li>As programmer, you will always face errors in your code and I experienced it a lot while working on my task and assignment.</li><li>Another problem I encounter was applying those different concepts I learnt in creating my library management system tasks.</li></ol><h3><strong>Conclusion</strong></h3><h3>Conclusion</h3><p>This week’s lessons were amazing but also filled with challenges. I went deeper into my Python learning and gained a better understanding of Object-Oriented Programming and how to apply the concepts I learnt.</p><p>See you in Week 3!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ca48713aa88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My First Week Learning Python With Dataraflow Internship: From the Basics to Building Small…]]></title>
            <link>https://medium.com/@preciousnwachukwu067/my-first-week-learning-python-with-dataraflow-internship-from-the-basics-to-building-small-05d644f4ced7?source=rss-c2a9b2a4dec5------2</link>
            <guid isPermaLink="false">https://medium.com/p/05d644f4ced7</guid>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Chinenye Precious Nwachukwu]]></dc:creator>
            <pubDate>Wed, 09 Sep 2026 10:33:21 GMT</pubDate>
            <atom:updated>2026-09-09T10:33:21.277Z</atom:updated>
            <content:encoded><![CDATA[<h3>My First Week Learning Python With Dataraflow Internship: From the Basics to Building Small Projects</h3><p><strong>INTRODUCTION</strong></p><p>Learning your first programming language can be both overwhelming and entirely unfamiliar. At the beginning you are trying to grasp and understand the fundamental such as variables, data types, functions, for loops, while loops, lists, and dictionaries, set, tuples, file handling etc. Which is a great deal to absorb all at once. The concepts may initially seem confusing, but they start to make sense gradually if you keep on practicing and remain patient.</p><p>This week in my Dataraflow internship program, I have come to understand that gaining a good understanding of the basics is essential in becoming a better programmer.</p><p>In this article I am going to talk about what I learned in my first week, the concepts that I looked at, some of the challenges I came across , and the progress I made.</p><h3>What I Learnt This Week</h3><p>This week, I was introduced to data science, which is an inter-disciplinary field that uses scientific method and processes to generate insights from structured and unstructured data. I also learnt about machine learning, which entails helping computer to learn from data, identify patterns, generate predictions and insights and improve performance without explicitly been programmed for all the task.</p><p>I learnt about the different type of data types in python which includes: numbers(float, integer, complex), strings, Boolean, list, set, dictionaries, tuples.</p><p>I also learnt comparison operations like &gt;,&lt; ≥,≤,== , !=, which are used to compare values. I also learnt about function and conditional statements which includes if, elif, else which is used when you want to make decision based on different conditions.</p><p>I learnt about list which are used to store multiple elements and dictionary that stores key-value pair data. I also learn about set and tuples. One amazing thing about tuples is that they are immutable meaning they can not be changed once they have been created.</p><p>Another interesting I learnt is lambda function which is used to create function in a concise way.<br>I also learnt about for and while loop which can be used to repeat a block of code. for loop is used to iterate sequence when you already know the number of time you want to iterate a sequence while the while loop will continue to repeat a block of code as long as the condition remains true.</p><p>Learning these concepts has improved my understanding of python and have given me confidence in writing codes and improving my programming skills.</p><h3>Task I Worked on</h3><ol><li><strong>Student Grade System:</strong></li></ol><p>One of the things I worked on was creating a simple student grade system. The task was to design a program that accepts five subjects marks of a student and calculates the total and average marks and finds out the grade of a student and displays the output.<br>To do this ,I declared an empty list to store the marks and used a `for` loop to allow the user to enter the marks for the five subjects. I then calculated the total marks by using the `sum()` function. I calculated the average by dividing the total by five.<br>And finally, I used `if`, `elif`, and `else` conditional statements to determine the grade based on the student’s average. For example, an average of 80 or above is an A, but if the average is below 40, then the grade is F.</p><pre># Create an empty list to store the marks<br>marks = []</pre><pre># Ask the user to enter marks for 5 subjects<br>for i in range(5):<br>    mark = float(input(f&quot;Enter mark for subject {i + 1}: &quot;))<br>    marks.append(mark)</pre><pre># Calculate the total marks<br>total = sum(marks)</pre><pre># Calculate the average<br>average = total / 5</pre><pre># Determine the grade<br>if average &gt;= 80:<br>    grade = &quot;A&quot;<br>elif average &gt;= 60:<br>    grade = &quot;B&quot;<br>elif average &gt;= 40:<br>    grade = &quot;C&quot;<br>else:<br>    grade = &quot;F&quot;</pre><pre># Display the results<br>print(&quot;\nTotal marks:&quot;, total)<br>print(&quot;Average:&quot;, average)<br>print(&quot;Grade:&quot;, grade)</pre><p>This task provided me with insight into how different Python concepts can work together to solve a practical problem. I was able to use lists, loops, user input, arithmetic operations and conditional statements in one program.</p><p><strong>2. Simple Calculator</strong></p><p>Another task I did was to make a simple calculator with Python. This program takes a pair of numbers as input then gives the user an option to choose an arithmetic operator such as addition (“+”), subtraction (“-”), multiplication (“*”) or division (“/”).</p><p>I used the “input()” function to get the numbers and the operator from the user. I also used “float()” to convert the numbers that the user entered to numerical values so that we maths operation can be done on them. I used conditional statements, “if”, “elif”, and “else”, to decide which calculation to perform. For example, the program adds the pair of numbers if the user enters “+”. If the user enters “-” then it will subtract second number from the first number. I added a “else” statement to handle an an invalid operator.</p><pre>num1 = float(input(&quot;Enter first number: &quot;))<br>operator = input(&quot;Enter operator (+, -, *, /): &quot;)<br>num2 = float(input(&quot;Enter second number: &quot;))<br><br>if operator == &quot;+&quot;:<br>    answer= num1 + num2<br>elif operator == &quot;-&quot;:<br>    answer = num1 - num2<br>elif operator == &quot;*&quot;:<br>    answer = num1 * num2<br>elif operator == &quot;/&quot;:<br>    answer = num1 / num2<br>else:<br>    answer = &quot;Invalid operator&quot;<br><br>print(&quot;Result:&quot;, answer)</pre><p>This task helped me understand conditional statements better and it showed me how a program can make different decisions based on the information given to the program by the user.</p><p><strong>3. Shopping Cart:</strong></p><p>Another thing I worked on was writing a simple shopping cart program in Python. The program takes the number of items to add to the cart as input and then takes the name and price of each item as input from the user. Then it shows the items in the cart and calculates the total cost.</p><p>I began by creating an empty dictionary to store the items and their prices. I used a `for` loop so that the user can enter multiple items depending on the number they entered. Each item was stored as a key in the dictionary, and its price as a value.Then I used the items() method to iterate over each item and price. Finally, I used the `values()` method and the `sum()` function to determine the total cost of all the items in the cart.</p><pre># Create an empty dictionary<br>cart = {}<br><br># Ask the user how many items they want to add<br>number = int(input(&quot;How many items do you want to add? &quot;))<br><br># Get the item names and prices<br>for i in range(number):<br>    item = input(&quot;Enter item name: &quot;)<br>    price = float(input(&quot;Enter item price: &quot;))<br><br>    # Add the item and price to the dictionary<br>    cart[item] = price<br><br># Display the items in the cart<br>print(&quot;\nShopping Cart:&quot;)<br><br>for item, price in cart.items():<br>    print(item, &quot;-&quot;, price)<br><br># Calculate the total cost<br>total = sum(cart.values())<br><br># Display the total<br>print(&quot;Total cost:&quot;, total)</pre><p>This task gave me a better understanding of dictionaries and showed me how dictionaries can be used to store related information in key-value pairs. It also provided more practice with loops, user input, and functions such as `sum()`.</p><h4>Challenges I Encountered.</h4><p><strong>1. Errors</strong>: I encountered different kinds of error such as syntax error, type errors . I learnt how to debug my code by reading the error message.</p><p>2. <strong>Knowing with function/ approach to take:</strong></p><p>As a beginner, one problem I faced was figuring the right function and approach to use in solving a particular problem.</p><p><strong>3. Applying what I learnt:</strong> Applying different concept logically together in solving problems was quite challenging for me.</p><p><strong>4. Indentation error:</strong> I faced indentation errors while working with if,elif,else,function, while and for loop.</p><p><strong>Conclusion</strong></p><p>My first week was challenging but I know that without challenges and seeking answers, I will not grow and become better.</p><p>Looking forward to learning,practicing,growing and becoming better in my data science journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05d644f4ced7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>