0

Why my code in learning Python : "CONTACT LIST" doesn't pass the test case? Eventually 1 test case. I think my code is right.

The code produce exactly the same as expected test-case output. I have capture the picture. Please friend, someone help me. https://code.sololearn.com/cjN0Wm9YrbmF/?ref=app

20th Feb 2023, 10:17 PM
Oliver Pasaribu
11 Answers
+ 2
Which course? Which task?
20th Feb 2023, 10:48 PM
Lisa
Lisa - avatar
+ 1
… it’s in the Python for Data Science course. You have an additional ‘s’, change ‘names’ to ‘name’ data = { 'names' Should be data = { 'name'
21st Feb 2023, 7:47 AM
DavX
DavX - avatar
+ 1
Do NOT change the given dictionary. Leave the dictionary key as "name". Compare to the output example in which it shows "name" as column name.
21st Feb 2023, 1:12 PM
Lisa
Lisa - avatar
+ 1
We print a pandas dataframe row. Hence the column names will be displayed. Hence the column names affect the comparison with the test case outputs.
21st Feb 2023, 1:57 PM
Lisa
Lisa - avatar
+ 1
Oliver, I haven't a clue what you are trying to get at... The practice you were trying to complete, it clearly states: "You are given a dictionary that contains names and numbers of people...." The dictionary is already provided, which was: data = { 'name': ['James', 'Billy', 'Bob', 'Amy', 'Tom'], 'number': ['1234', '5678', '2222', '1111', '0909'] } You have duplicated (now commented out) this dictionary, with 'names' instead of 'name'. Your first attempt was working (yet not passing the tests), because you were using the duplicated dictionary with the column named 'names' - now you've switched this back to the original dictionary it passes all the tests.
21st Feb 2023, 2:03 PM
DavX
DavX - avatar
0
I don't understand what you mean. DaveX, PLEASE READ THIS CAREFULY. "You can think of a Series as a one-dimensional array, while a DataFrame is a multi-dimensional array." This is a similar to built a grahics for series of data x- axes y-axis. Strictly speaking, this is a table. Each row in table is a sungle dimension array costruct of similar data type. For this case, map, K-V pairs one to one. It can be modified that each record, rows represents each individual person name could have 2 contact numbers, each for resident or office number. Or, fixed and mobile number. Or it similar to monthly sales revenue from some salesperson of a company. Name or names it just naming convention.
21st Feb 2023, 12:49 PM
Oliver Pasaribu
0
This can be considered similar to problem of linear programming optimization. What do you think, DaveX?
21st Feb 2023, 12:51 PM
Oliver Pasaribu
0
Hey Oliver, What part don’t you understand? Did you remove the typo (additional s) to get your solution working?
21st Feb 2023, 1:01 PM
DavX
DavX - avatar
0
The hint said that dictionary is a pairs of Keys-Value between Names-Numbers. I didn't changed it. 'names' is naming convention that first column is a name from name[0] to name[len(name)-1]. It rows further indexed by name. (Default by row numbering index).
21st Feb 2023, 1:41 PM
Oliver Pasaribu
0
This is like problem that often arise or asled in research operations. It depends on how we formulate the problem.
21st Feb 2023, 1:42 PM
Oliver Pasaribu
0
I am not so sure or ... Yes, it might be happened
21st Feb 2023, 4:19 PM
Oliver Pasaribu