Loading Data

Correcting Assignment 2

On assignment 2 I was confused about a thing and did a thing wrong.

First I had a typo

import panda as pd
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-f542dbfa5144> in <module>
----> 1 import panda as pd

ModuleNotFoundError: No module named 'panda'

Now I know that the correct name is pandas

import pandas as pd

That cost me a lot of time but I also wrote psuedo code anyway, it wasn’t right though since I couldn’t see the output

#  code that ran but produce the wrong output

this should have been this way instead

#  code that is fixed

I learned that this method works by doing some steps, here is a way we can see about that functionality

#  code that demos a feature or inspects a value

Other ways of loading data

Another thing we can do loading data is something, that looks like this

#  code

this would be good for these situations, but a risk of doign that is something, we can see that by

#  code that does a bad thing

and then we investigate

#  code that shows why that's bad

This is especially good when something is true beacuse it’s faster

%%timeit
# one way  code
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-734253614b43> in <module>
----> 1 get_ipython().run_cell_magic('timeit', '', '# one way  code\n')

/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
   2380             with self.builtin_trap:
   2381                 args = (magic_arg_s, cell)
-> 2382                 result = fn(*args, **kwargs)
   2383             return result
   2384 

<decorator-gen-53> in timeit(self, line, cell, local_ns)

/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/IPython/core/magics/execution.py in timeit(self, line, cell, local_ns)
   1144 
   1145         t0 = clock()
-> 1146         code = self.shell.compile(timeit_ast, "<magic-timeit>", "exec")
   1147         tc = clock()-t0
   1148 

/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/codeop.py in __call__(self, source, filename, symbol)
    139 
    140     def __call__(self, source, filename, symbol):
--> 141         codeob = compile(source, filename, symbol, self.flags, 1)
    142         for feature in _features:
    143             if codeob.co_flags & feature.compiler_flag:

ValueError: empty body on For
%%timeit
# other way code
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-10-86aaa9f4f0dd> in <module>
----> 1 get_ipython().run_cell_magic('timeit', '', '# other way code\n')

/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
   2380             with self.builtin_trap:
   2381                 args = (magic_arg_s, cell)
-> 2382                 result = fn(*args, **kwargs)
   2383             return result
   2384 

<decorator-gen-53> in timeit(self, line, cell, local_ns)

/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/IPython/core/magics/execution.py in timeit(self, line, cell, local_ns)
   1144 
   1145         t0 = clock()
-> 1146         code = self.shell.compile(timeit_ast, "<magic-timeit>", "exec")
   1147         tc = clock()-t0
   1148 

/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/codeop.py in __call__(self, source, filename, symbol)
    139 
    140     def __call__(self, source, filename, symbol):
--> 141         codeob = compile(source, filename, symbol, self.flags, 1)
    142         for feature in _features:
    143             if codeob.co_flags & feature.compiler_flag:

ValueError: empty body on For