ashomah / ie_pandas Goto Github PK
View Code? Open in Web Editor NEWie_pandas package
ie_pandas package
I noticed that you are importing numpy inside the class definition:
However, it doesn't work as you expect:
juanlu@centauri /tmp $ cat importing.py
class Foo:
import numpy as np
def foo(self):
return np.arange(4)
def correct_foo(self):
return self.np.arange(4)
juanlu@centauri /tmp $ python3 -q
>>> from importing import Foo
>>> f = Foo()
>>> f.foo()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/importing.py", line 4, in foo
return np.arange(4)
NameError: name 'np' is not defined
>>> f.correct_foo()
array([0, 1, 2, 3])
You still don't have tests for DataFrame
(#5) and that's why you probably didn't notice so far.
Dear @Juanlu001,
we have a recurring problem during the testing. We want to test our DataFrame class for converting different input types with different value types in it against an expected_output print of the dataframe.
As an example, one of the pytests we made for this is the following
from ie_pandas import DataFrame
import pytest
def test_string_input_in_list():
artists_age_list = ["James Blake", "Björk", "Christine & The Queens", "DJ Koze", "Solange"]
df1 = DataFrame(artists_age_list)
expected_output = 0\n0 James Blake\n1 Björk\n2 Christine & The Queens\n3 DJ Koze\n4 Solange
actual_output = df1
assert actual_output == expected_output
The problem situates itself on the expected_output line. We get the following error running pytest:
Also when we put quotation marks around the output, an Assertion error is risen.
How can we overcome this and make our test successful?
Thanks in advance!
It seems that you are all pushing branches to this repository, and that you are not using forks:
https://github.com/lhandal/ie_pandas/network/members
Even though some projects are carried out like this, I explicitly instructed you to work from forks:
"The library must be developed incrementally, using pull requests that should depart from a fork branch (i.e. not from master, not from a branch in the same repository)"
The reasons are mainly three:
Please keep this in mind from now on
You are adding a lot of functionality that is not tested. I recommend that you
Otherwise, there's a risk you leave the tests for the very end, and believe me - you will find last-minute problems that will make your life more difficult.
Hi @Juanlu001 ,
I'm reviewing our code using pycodestyle, and it returns many errors "E501 line too long".
How important are these ?
Our max line length is currently 88 characters.
Thank you !
Dear @Juanlu001,
when doing pytest --cov=ie_pandas tests/OK in our latest version with all working tests, seven tests are passed correctly and everything seems to be fine. However, all tests we wrote regarding datatypes seem to be ignored. Here you see an example of a test to see if a dict_of_lists with floats can be correctly converted to a df.
from ie_pandas import DataFrame
import pytest
def float_input_in_dict_of_lists():
artists_dict_of_lists = {'age':[30.0, 53.0, 31.0, 47.0, 32.0], 'albums':[4.0, 10.0, 2.0, 5.0, 4.0]}
dict_of_lists_df = DataFrame(artists_dict_of_lists, rowindex = ['R1', 'R2', 'R3', 'R4', 'R5'], colindex=['age', 'albums'])
expected_output = "age albums/nR1 30.0 4.0/nR2 53.0 10.0/nR3 31.0 2.0/nR4 47.0 5.0/nR5 32.0 4.0"
actual_output = DataFrame(dict_of_lists_df)
assert actual_output == expected_output
Can you tell us what should be rewritten to make this test passing as well?
Thanks in advance!
Even though you properly defined a .gitignore
file, some .DS_Store
files ended up in the repository. You should remove them.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.