|
249 | 249 | } |
250 | 250 | ], |
251 | 251 | "source": [ |
252 | | - "schema = dj.schema('tutorial')" |
| 252 | + "schema = dj.schema(\"tutorial\")" |
253 | 253 | ] |
254 | 254 | }, |
255 | 255 | { |
|
421 | 421 | "metadata": {}, |
422 | 422 | "outputs": [], |
423 | 423 | "source": [ |
424 | | - "Mouse.insert1((0, '2017-03-01', 'M'))" |
| 424 | + "Mouse.insert1((0, \"2017-03-01\", \"M\"))" |
425 | 425 | ] |
426 | 426 | }, |
427 | 427 | { |
|
533 | 533 | "metadata": {}, |
534 | 534 | "outputs": [], |
535 | 535 | "source": [ |
536 | | - "data = {\n", |
537 | | - " 'mouse_id': 100,\n", |
538 | | - " 'dob': '2017-05-12',\n", |
539 | | - " 'sex': 'F'\n", |
540 | | - "}" |
| 536 | + "data = {\"mouse_id\": 100, \"dob\": \"2017-05-12\", \"sex\": \"F\"}" |
541 | 537 | ] |
542 | 538 | }, |
543 | 539 | { |
|
661 | 657 | "metadata": {}, |
662 | 658 | "outputs": [], |
663 | 659 | "source": [ |
664 | | - "data = [\n", |
665 | | - " (1, '2016-11-19', 'M'),\n", |
666 | | - " (2, '2016-11-20', 'unknown'),\n", |
667 | | - " (5, '2016-12-25', 'F')\n", |
668 | | - "]" |
| 660 | + "data = [(1, \"2016-11-19\", \"M\"), (2, \"2016-11-20\", \"unknown\"), (5, \"2016-12-25\", \"F\")]" |
669 | 661 | ] |
670 | 662 | }, |
671 | 663 | { |
|
691 | 683 | "outputs": [], |
692 | 684 | "source": [ |
693 | 685 | "data = [\n", |
694 | | - " {'mouse_id': 10, 'dob': '2017-01-01', 'sex': 'F'},\n", |
695 | | - " {'mouse_id': 11, 'dob': '2017-01-03', 'sex': 'F'},\n", |
| 686 | + " {\"mouse_id\": 10, \"dob\": \"2017-01-01\", \"sex\": \"F\"},\n", |
| 687 | + " {\"mouse_id\": 11, \"dob\": \"2017-01-03\", \"sex\": \"F\"},\n", |
696 | 688 | "]\n", |
697 | 689 | "\n", |
698 | 690 | "# insert them all\n", |
|
848 | 840 | ], |
849 | 841 | "source": [ |
850 | 842 | "Mouse.insert1(\n", |
851 | | - "{'mouse_id': 0,\n", |
852 | | - " 'dob': '2018-01-01',\n", |
853 | | - " 'sex': 'M',\n", |
854 | | - "})" |
| 843 | + " {\n", |
| 844 | + " \"mouse_id\": 0,\n", |
| 845 | + " \"dob\": \"2018-01-01\",\n", |
| 846 | + " \"sex\": \"M\",\n", |
| 847 | + " }\n", |
| 848 | + ")" |
855 | 849 | ] |
856 | 850 | }, |
857 | 851 | { |
|
868 | 862 | "outputs": [], |
869 | 863 | "source": [ |
870 | 864 | "data = [\n", |
871 | | - " {'mouse_id': 12, 'dob': '2017-03-21', 'sex': 'F'},\n", |
872 | | - " {'mouse_id': 18, 'dob': '2017-05-01', 'sex': 'F'},\n", |
873 | | - " {'mouse_id': 19, 'dob': '2018-07-21', 'sex': 'M'},\n", |
874 | | - " {'mouse_id': 22, 'dob': '2019-12-15', 'sex': 'F'},\n", |
875 | | - " {'mouse_id': 34, 'dob': '2018-09-22', 'sex': 'M'}\n", |
| 865 | + " {\"mouse_id\": 12, \"dob\": \"2017-03-21\", \"sex\": \"F\"},\n", |
| 866 | + " {\"mouse_id\": 18, \"dob\": \"2017-05-01\", \"sex\": \"F\"},\n", |
| 867 | + " {\"mouse_id\": 19, \"dob\": \"2018-07-21\", \"sex\": \"M\"},\n", |
| 868 | + " {\"mouse_id\": 22, \"dob\": \"2019-12-15\", \"sex\": \"F\"},\n", |
| 869 | + " {\"mouse_id\": 34, \"dob\": \"2018-09-22\", \"sex\": \"M\"},\n", |
876 | 870 | "]\n", |
877 | 871 | "\n", |
878 | 872 | "# insert them all\n", |
|
1014 | 1008 | "metadata": {}, |
1015 | 1009 | "outputs": [], |
1016 | 1010 | "source": [ |
1017 | | - "# ENTER YOUR CODE - Insert more mice\n" |
| 1011 | + "# ENTER YOUR CODE - Insert more mice" |
1018 | 1012 | ] |
1019 | 1013 | }, |
1020 | 1014 | { |
|
1135 | 1129 | "outputs": [], |
1136 | 1130 | "source": [ |
1137 | 1131 | "data = {\n", |
1138 | | - " 'mouse_id': 0,\n", |
1139 | | - " 'session_date': '2017-05-15',\n", |
1140 | | - " 'experiment_setup': 0,\n", |
1141 | | - " 'experimenter': 'Edgar Y. Walker'\n", |
| 1132 | + " \"mouse_id\": 0,\n", |
| 1133 | + " \"session_date\": \"2017-05-15\",\n", |
| 1134 | + " \"experiment_setup\": 0,\n", |
| 1135 | + " \"experimenter\": \"Edgar Y. Walker\",\n", |
1142 | 1136 | "}\n", |
1143 | 1137 | "\n", |
1144 | 1138 | "Session.insert1(data)" |
|
1362 | 1356 | ], |
1363 | 1357 | "source": [ |
1364 | 1358 | "data = {\n", |
1365 | | - " 'mouse_id': 0,\n", |
1366 | | - " 'session_date': '2018-01-15',\n", |
1367 | | - " 'experiment_setup': 100,\n", |
1368 | | - " 'experimenter': 'Jacob Reimer'\n", |
| 1359 | + " \"mouse_id\": 0,\n", |
| 1360 | + " \"session_date\": \"2018-01-15\",\n", |
| 1361 | + " \"experiment_setup\": 100,\n", |
| 1362 | + " \"experimenter\": \"Jacob Reimer\",\n", |
1369 | 1363 | "}\n", |
1370 | 1364 | "\n", |
1371 | 1365 | "Session.insert1(data)\n", |
|
1387 | 1381 | "outputs": [], |
1388 | 1382 | "source": [ |
1389 | 1383 | "data = {\n", |
1390 | | - " 'mouse_id': 18,\n", |
1391 | | - " 'session_date': '2018-01-15',\n", |
1392 | | - " 'experiment_setup': 101,\n", |
1393 | | - " 'experimenter': 'Jacob Reimer'\n", |
| 1384 | + " \"mouse_id\": 18,\n", |
| 1385 | + " \"session_date\": \"2018-01-15\",\n", |
| 1386 | + " \"experiment_setup\": 101,\n", |
| 1387 | + " \"experimenter\": \"Jacob Reimer\",\n", |
1394 | 1388 | "}\n", |
1395 | 1389 | "\n", |
1396 | 1390 | "# insert them all\n", |
|
1525 | 1519 | "outputs": [], |
1526 | 1520 | "source": [ |
1527 | 1521 | "bad_data = {\n", |
1528 | | - " 'mouse_id': 9999, # this mouse doesn't exist!\n", |
1529 | | - " 'session_date': '2017-05-15',\n", |
1530 | | - " 'experiment_setup': 0,\n", |
1531 | | - " 'experimenter': 'Edgar Y. Walker'\n", |
| 1522 | + " \"mouse_id\": 9999, # this mouse doesn't exist!\n", |
| 1523 | + " \"session_date\": \"2017-05-15\",\n", |
| 1524 | + " \"experiment_setup\": 0,\n", |
| 1525 | + " \"experimenter\": \"Edgar Y. Walker\",\n", |
1532 | 1526 | "}" |
1533 | 1527 | ] |
1534 | 1528 | }, |
|
1709 | 1703 | } |
1710 | 1704 | ], |
1711 | 1705 | "source": [ |
1712 | | - "Mouse & 'mouse_id = 0'" |
| 1706 | + "Mouse & \"mouse_id = 0\"" |
1713 | 1707 | ] |
1714 | 1708 | }, |
1715 | 1709 | { |
|
2886 | 2880 | } |
2887 | 2881 | ], |
2888 | 2882 | "source": [ |
2889 | | - "female_mice & 'mouse_id > 10'" |
| 2883 | + "female_mice & \"mouse_id > 10\"" |
2890 | 2884 | ] |
2891 | 2885 | }, |
2892 | 2886 | { |
|
3006 | 3000 | } |
3007 | 3001 | ], |
3008 | 3002 | "source": [ |
3009 | | - "Mouse & Session " |
| 3003 | + "Mouse & Session" |
3010 | 3004 | ] |
3011 | 3005 | }, |
3012 | 3006 | { |
|
3999 | 3993 | } |
4000 | 3994 | ], |
4001 | 3995 | "source": [ |
4002 | | - "Mouse.proj('sex')" |
| 3996 | + "Mouse.proj(\"sex\")" |
4003 | 3997 | ] |
4004 | 3998 | }, |
4005 | 3999 | { |
|
4129 | 4123 | } |
4130 | 4124 | ], |
4131 | 4125 | "source": [ |
4132 | | - "Mouse.proj(date_of_birth='dob')" |
| 4126 | + "Mouse.proj(date_of_birth=\"dob\")" |
4133 | 4127 | ] |
4134 | 4128 | }, |
4135 | 4129 | { |
|
4239 | 4233 | } |
4240 | 4234 | ], |
4241 | 4235 | "source": [ |
4242 | | - "(Mouse * Session).proj(age='datediff(session_date, dob)')" |
| 4236 | + "(Mouse * Session).proj(age=\"datediff(session_date, dob)\")" |
4243 | 4237 | ] |
4244 | 4238 | }, |
4245 | 4239 | { |
|
4379 | 4373 | } |
4380 | 4374 | ], |
4381 | 4375 | "source": [ |
4382 | | - "(Mouse * Session).proj(..., age='datediff(session_date, dob)')" |
| 4376 | + "(Mouse * Session).proj(..., age=\"datediff(session_date, dob)\")" |
4383 | 4377 | ] |
4384 | 4378 | }, |
4385 | 4379 | { |
|
4690 | 4684 | } |
4691 | 4685 | ], |
4692 | 4686 | "source": [ |
4693 | | - "(Mouse & 'sex = \"M\"').fetch(format='frame')" |
| 4687 | + "(Mouse & 'sex = \"M\"').fetch(format=\"frame\")" |
4694 | 4688 | ] |
4695 | 4689 | }, |
4696 | 4690 | { |
|
4717 | 4711 | } |
4718 | 4712 | ], |
4719 | 4713 | "source": [ |
4720 | | - "(Mouse & 'sex = \"M\"').fetch('KEY')" |
| 4714 | + "(Mouse & 'sex = \"M\"').fetch(\"KEY\")" |
4721 | 4715 | ] |
4722 | 4716 | }, |
4723 | 4717 | { |
|
4733 | 4727 | "metadata": {}, |
4734 | 4728 | "outputs": [], |
4735 | 4729 | "source": [ |
4736 | | - "sex, dob = Mouse.fetch('sex', 'dob')" |
| 4730 | + "sex, dob = Mouse.fetch(\"sex\", \"dob\")" |
4737 | 4731 | ] |
4738 | 4732 | }, |
4739 | 4733 | { |
|
4818 | 4812 | } |
4819 | 4813 | ], |
4820 | 4814 | "source": [ |
4821 | | - "info = Mouse.fetch('sex', 'dob', as_dict=True)\n", |
| 4815 | + "info = Mouse.fetch(\"sex\", \"dob\", as_dict=True)\n", |
4822 | 4816 | "info" |
4823 | 4817 | ] |
4824 | 4818 | }, |
|
4853 | 4847 | } |
4854 | 4848 | ], |
4855 | 4849 | "source": [ |
4856 | | - "mouse_0 = (Mouse & {'mouse_id': 0}).fetch1() # \"fetch1()\" because we know there's only one\n", |
| 4850 | + "mouse_0 = (\n", |
| 4851 | + " Mouse & {\"mouse_id\": 0}\n", |
| 4852 | + ").fetch1() # \"fetch1()\" because we know there's only one\n", |
4857 | 4853 | "mouse_0" |
4858 | 4854 | ] |
4859 | 4855 | }, |
|
4881 | 4877 | } |
4882 | 4878 | ], |
4883 | 4879 | "source": [ |
4884 | | - "(Mouse & {'mouse_id': 0}).fetch1('KEY')" |
| 4880 | + "(Mouse & {\"mouse_id\": 0}).fetch1(\"KEY\")" |
4885 | 4881 | ] |
4886 | 4882 | }, |
4887 | 4883 | { |
|
4897 | 4893 | "metadata": {}, |
4898 | 4894 | "outputs": [], |
4899 | 4895 | "source": [ |
4900 | | - "sex, dob = (Mouse & {'mouse_id': 0}).fetch1('sex', 'dob')" |
| 4896 | + "sex, dob = (Mouse & {\"mouse_id\": 0}).fetch1(\"sex\", \"dob\")" |
4901 | 4897 | ] |
4902 | 4898 | }, |
4903 | 4899 | { |
|
4978 | 4974 | } |
4979 | 4975 | ], |
4980 | 4976 | "source": [ |
4981 | | - "(Mouse & 'mouse_id = 100').delete()" |
| 4977 | + "(Mouse & \"mouse_id = 100\").delete()" |
4982 | 4978 | ] |
4983 | 4979 | }, |
4984 | 4980 | { |
|
0 commit comments