workspace
stringclasses 1
value | channel
stringclasses 1
value | sentences
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
| sentence_id
stringlengths 44
53
| timestamp
float64 1.5B
1.56B
| __index_level_0__
int64 0
106k
|
---|---|---|---|---|---|---|---|
pythondev | help | <@Carmen> at my last job I built out a 100% redundant Linux based web environment and used Nagios to monitor it with EASE. then expanded and was monitroing windows servers, printers and everything else | 2019-05-17T15:22:47.033100 | Walton | pythondev_help_Walton_2019-05-17T15:22:47.033100 | 1,558,106,567.0331 | 24,121 |
pythondev | help | emails got sent out to Office Services to order toner, Admins knew about Storage creep, desktop knew that machines were unresponsive.... what are you trying to monitor? | 2019-05-17T15:23:25.034800 | Walton | pythondev_help_Walton_2019-05-17T15:23:25.034800 | 1,558,106,605.0348 | 24,122 |
pythondev | help | AWS EC2 for the *real* production stuff, though I'll be spinning up one in my local lab server to monitor private VMs, so a SaaS solution isn't really viable. | 2019-05-17T15:23:25.034900 | Carmen | pythondev_help_Carmen_2019-05-17T15:23:25.034900 | 1,558,106,605.0349 | 24,123 |
pythondev | help | paid: datadog and new relic.
free: promethus, grafana | 2019-05-17T15:23:41.035200 | Hiroko | pythondev_help_Hiroko_2019-05-17T15:23:41.035200 | 1,558,106,621.0352 | 24,124 |
pythondev | help | <@Walton> <https://jakevdp.github.io/PythonDataScienceHandbook/03.00-introduction-to-pandas.html> | 2019-05-17T15:23:48.035400 | Bethany | pythondev_help_Bethany_2019-05-17T15:23:48.035400 | 1,558,106,628.0354 | 24,125 |
pythondev | help | ::taco:: <@Bethany> thanks man, i'll check it out | 2019-05-17T15:24:13.036000 | Walton | pythondev_help_Walton_2019-05-17T15:24:13.036000 | 1,558,106,653.036 | 24,126 |
pythondev | help | <@Carmen> you might want to join <http://hangops.slack.com|hangops.slack.com> to ask this question. But I’d look at <https://prometheus.io/> | 2019-05-17T15:24:14.036100 | Brain | pythondev_help_Brain_2019-05-17T15:24:14.036100 | 1,558,106,654.0361 | 24,127 |
pythondev | help | <@Walton> I'm planning to monitor VMs almost exclusively. Webapps hosted thereon, and health checks on the servers themselves (disk usage, inode creep, etc.) | 2019-05-17T15:26:23.037500 | Carmen | pythondev_help_Carmen_2019-05-17T15:26:23.037500 | 1,558,106,783.0375 | 24,128 |
pythondev | help | Well VM or bare metal doesn't matter, all that matters is that it has a pulse[IP]. You can monitor everything, from ports, to storage, to logs, to ssh traffic. Basically everything for a production web environment, Nagios has got you covered. That isn't to say Prometheus or any other suggestion is bad, I just have not worked with those at all. As a guy who just started learning python, I had Nagios fully functional for day to day and the DEV team at my last spot, with zero python knowledge. | 2019-05-17T15:28:38.039800 | Walton | pythondev_help_Walton_2019-05-17T15:28:38.039800 | 1,558,106,918.0398 | 24,129 |
pythondev | help | now if you're talking about centralized logging type monitoring, I'd recommend an ELK stack | 2019-05-17T15:28:59.040300 | Walton | pythondev_help_Walton_2019-05-17T15:28:59.040300 | 1,558,106,939.0403 | 24,130 |
pythondev | help | At the moment, I'm more concerned with making sure everything is alive and not dying rather than metrics tracking. ELK is my target for centralized logging and metrics tracking later on. | 2019-05-17T15:34:09.041700 | Carmen | pythondev_help_Carmen_2019-05-17T15:34:09.041700 | 1,558,107,249.0417 | 24,131 |
pythondev | help | well ping is the default module for Nagios. however, to me that means nothing, as a machine can be a vegetable. | 2019-05-17T15:42:37.042600 | Walton | pythondev_help_Walton_2019-05-17T15:42:37.042600 | 1,558,107,757.0426 | 24,132 |
pythondev | help | I'd branch out from there and turn on port monitoring. | 2019-05-17T15:42:52.043000 | Walton | pythondev_help_Walton_2019-05-17T15:42:52.043000 | 1,558,107,772.043 | 24,133 |
pythondev | help | for HTTP/S I'd have a healthcheck page and check it for a return to make sure metadata is present, this way you'd know that not only is port 80/443 is open but it is hosting too | 2019-05-17T15:43:36.044000 | Walton | pythondev_help_Walton_2019-05-17T15:43:36.044000 | 1,558,107,816.044 | 24,134 |
pythondev | help | you can do SSH monitoring to see if accounts outside a list of accounts is trying to login. | 2019-05-17T15:44:13.044500 | Walton | pythondev_help_Walton_2019-05-17T15:44:13.044500 | 1,558,107,853.0445 | 24,135 |
pythondev | help | and from there, storage, ram, cpu monitoring. only set it to alert you and your team when there is a problem, and a "everything works" alert daily so you know it's all still running | 2019-05-17T15:45:05.045600 | Walton | pythondev_help_Walton_2019-05-17T15:45:05.045600 | 1,558,107,905.0456 | 24,136 |
pythondev | help | then with grafana or the built in NAGIOS mappign tool, you can have a dedicated monitor with a topography map of your entire map, looking to see if errors pop up | 2019-05-17T15:45:45.046500 | Walton | pythondev_help_Walton_2019-05-17T15:45:45.046500 | 1,558,107,945.0465 | 24,137 |
pythondev | help | My apologies to everyone for going off-topic on this. its just the only thing I can actually contribute with at the moment with my current skillset. | 2019-05-17T15:46:13.047100 | Walton | pythondev_help_Walton_2019-05-17T15:46:13.047100 | 1,558,107,973.0471 | 24,138 |
pythondev | help | no worries! | 2019-05-17T15:47:29.047400 | Hiroko | pythondev_help_Hiroko_2019-05-17T15:47:29.047400 | 1,558,108,049.0474 | 24,139 |
pythondev | help | sounds liek a good topic for <#C22DMH61M|devops> :slightly_smiling_face: | 2019-05-17T15:47:36.047800 | Hiroko | pythondev_help_Hiroko_2019-05-17T15:47:36.047800 | 1,558,108,056.0478 | 24,140 |
pythondev | help | you make a good point with healthcheck, since it just checks whether a machine is up or not. It helps to be able to do more, and that’s part of my I take k8s healthcheck with a large grain of salt | 2019-05-17T15:48:31.048800 | Hiroko | pythondev_help_Hiroko_2019-05-17T15:48:31.048800 | 1,558,108,111.0488 | 24,141 |
pythondev | help | <#C22DMH61M|devops> is the one channel i didn't join, as i'm only here to learn to code | 2019-05-17T15:49:14.049200 | Walton | pythondev_help_Walton_2019-05-17T15:49:14.049200 | 1,558,108,154.0492 | 24,142 |
pythondev | help | :stuck_out_tongue: | 2019-05-17T15:49:19.049400 | Walton | pythondev_help_Walton_2019-05-17T15:49:19.049400 | 1,558,108,159.0494 | 24,143 |
pythondev | help | <@Walton> :taco: for your advice, it's much appreciated. | 2019-05-17T16:53:50.051100 | Carmen | pythondev_help_Carmen_2019-05-17T16:53:50.051100 | 1,558,112,030.0511 | 24,144 |
pythondev | help | anytime :slightly_smiling_face: | 2019-05-17T16:54:26.051300 | Walton | pythondev_help_Walton_2019-05-17T16:54:26.051300 | 1,558,112,066.0513 | 24,145 |
pythondev | help | The docs tell me to use `python3 -m venv tutorial-env` (<https://docs.python.org/3/tutorial/venv.html>) to create new virtualenvironments. But every time I use this, source the virtualenvironment, and run pip I get a message telling my pip is out of date. I have tried updating pip without have the virtualenvironment active, upgrading pip in virtual environment. But both do not upgrade the version of pip that is installed when I use venv to create my next virtual environment | 2019-05-17T17:08:30.055800 | Sterling | pythondev_help_Sterling_2019-05-17T17:08:30.055800 | 1,558,112,910.0558 | 24,146 |
pythondev | help | So how do you upgrade the pip package that is being used to create virtualenvironments by venv? Do I have to upgrade venv itself? If so, how? | 2019-05-17T17:09:00.056500 | Sterling | pythondev_help_Sterling_2019-05-17T17:09:00.056500 | 1,558,112,940.0565 | 24,147 |
pythondev | help | Well, kinda | 2019-05-17T17:42:39.057000 | Nigel | pythondev_help_Nigel_2019-05-17T17:42:39.057000 | 1,558,114,959.057 | 24,148 |
pythondev | help | You can see pip bundled with python here: <https://github.com/python/cpython/tree/e42b705188271da108de42b55d9344642170aa2b/Lib/ensurepip/_bundled> | 2019-05-17T17:42:51.057600 | Nigel | pythondev_help_Nigel_2019-05-17T17:42:51.057600 | 1,558,114,971.0576 | 24,149 |
pythondev | help | thats the exact version I have when I use PIP in venv. 10.0.1. So am I stuck with 10.0.1 on fresh VENV until I update it inside the venv or that cpython gets updated? | 2019-05-17T17:43:42.058600 | Sterling | pythondev_help_Sterling_2019-05-17T17:43:42.058600 | 1,558,115,022.0586 | 24,150 |
pythondev | help | Usually you can install virtualenv as a separate package for your OS, it usually installs the new version of pip | 2019-05-17T17:44:22.059700 | Nigel | pythondev_help_Nigel_2019-05-17T17:44:22.059700 | 1,558,115,062.0597 | 24,151 |
pythondev | help | I used to use virtualenv but recently I saw that python docs were recommending `python3 -m venv tutorial-env`. Do you know if there is any reason why they suggest that module now over virtualenv package I used to use? | 2019-05-17T17:45:08.061100 | Sterling | pythondev_help_Sterling_2019-05-17T17:45:08.061100 | 1,558,115,108.0611 | 24,152 |
pythondev | help | The only reason I switched was because docs were using it | 2019-05-17T17:45:25.061400 | Sterling | pythondev_help_Sterling_2019-05-17T17:45:25.061400 | 1,558,115,125.0614 | 24,153 |
pythondev | help | > Do you know if there is any reason why they suggest that module now over virtualenv package I used to use?
The reason is that they'be brought virtualenv into the distribution of python | 2019-05-17T17:46:02.062600 | Nigel | pythondev_help_Nigel_2019-05-17T17:46:02.062600 | 1,558,115,162.0626 | 24,154 |
pythondev | help | I don't know if I'm correct, but I'm pretty sure about it | 2019-05-17T17:46:23.063600 | Nigel | pythondev_help_Nigel_2019-05-17T17:46:23.063600 | 1,558,115,183.0636 | 24,155 |
pythondev | help | There are also tools which help you with creating virtual environments without thinking too much about them. The best of such tools is called poetry: <https://github.com/sdispater/poetry> | 2019-05-17T17:46:49.064400 | Nigel | pythondev_help_Nigel_2019-05-17T17:46:49.064400 | 1,558,115,209.0644 | 24,156 |
pythondev | help | What do you guys use? | 2019-05-17T17:47:02.065000 | Sterling | pythondev_help_Sterling_2019-05-17T17:47:02.065000 | 1,558,115,222.065 | 24,157 |
pythondev | help | It handles virtual environments and packaging | 2019-05-17T17:47:10.065300 | Nigel | pythondev_help_Nigel_2019-05-17T17:47:10.065300 | 1,558,115,230.0653 | 24,158 |
pythondev | help | There is also virtualenvwrapper (<https://virtualenvwrapper.readthedocs.io/en/latest/>) which I used to use before, and pipenv (<https://github.com/pypa/pipenv>) | 2019-05-17T17:48:01.066800 | Nigel | pythondev_help_Nigel_2019-05-17T17:48:01.066800 | 1,558,115,281.0668 | 24,159 |
pythondev | help | I don’t think you can really solve this in any permanent way. Every time a new version of `pip` releases, you’ll see that message.
It takes time to update that version in `virtualenv`, `venv` and other packages. So, on your system `pip` will always be lagging behind unless you upgrade it right after creating venv. | 2019-05-17T17:48:31.067500 | Brain | pythondev_help_Brain_2019-05-17T17:48:31.067500 | 1,558,115,311.0675 | 24,160 |
pythondev | help | Agreed, its a battle of keep up but 10.0.1 visually looks very far behind the 19.* that is current release | 2019-05-17T17:49:29.068200 | Sterling | pythondev_help_Sterling_2019-05-17T17:49:29.068200 | 1,558,115,369.0682 | 24,161 |
pythondev | help | debian stable is on 9.0.1 :slightly_smiling_face: | 2019-05-17T17:50:47.069900 | Brain | pythondev_help_Brain_2019-05-17T17:50:47.069900 | 1,558,115,447.0699 | 24,162 |
pythondev | help | Thanks for explanations on why it ships with 10.0.1. Just have been super curious as to why it installs that version when my system had the latest/greatest | 2019-05-17T17:50:48.070100 | Sterling | pythondev_help_Sterling_2019-05-17T17:50:48.070100 | 1,558,115,448.0701 | 24,163 |
pythondev | help | Wow! <@Brain> | 2019-05-17T17:51:38.071200 | Sterling | pythondev_help_Sterling_2019-05-17T17:51:38.071200 | 1,558,115,498.0712 | 24,164 |
pythondev | help | do you happen to have python2 installed on your machine too? | 2019-05-17T17:56:22.072000 | Brain | pythondev_help_Brain_2019-05-17T17:56:22.072000 | 1,558,115,782.072 | 24,165 |
pythondev | help | I do | 2019-05-17T18:09:26.072800 | Sterling | pythondev_help_Sterling_2019-05-17T18:09:26.072800 | 1,558,116,566.0728 | 24,166 |
pythondev | help | I have a mac and python2 was preinstalled. But I installed python3 via homebrew. When I rune the venv module though I do run `python3 -m venv new-venv`. Do you think python2 is interfering somehow? | 2019-05-17T18:10:10.073000 | Sterling | pythondev_help_Sterling_2019-05-17T18:10:10.073000 | 1,558,116,610.073 | 24,167 |
pythondev | help | `PIP_DISABLE_PIP_VERSION_CHECK=1` | 2019-05-17T18:39:03.073300 | Karoline | pythondev_help_Karoline_2019-05-17T18:39:03.073300 | 1,558,118,343.0733 | 24,168 |
pythondev | help | Is there a `PIP_UPDATE_ON_INSTALL=1`? That would be ideal | 2019-05-17T18:44:18.073900 | Sterling | pythondev_help_Sterling_2019-05-17T18:44:18.073900 | 1,558,118,658.0739 | 24,169 |
pythondev | help | Hey everyone. Can I get a detailed explanation on this program. I know what it does but just cant understand how it does it | 2019-05-17T19:12:58.075700 | Ressie | pythondev_help_Ressie_2019-05-17T19:12:58.075700 | 1,558,120,378.0757 | 24,170 |
pythondev | help | The code counts the number of times the word "bob" appears in the variable s. I just dont know how it does it | 2019-05-17T19:17:06.076100 | Ressie | pythondev_help_Ressie_2019-05-17T19:17:06.076100 | 1,558,120,626.0761 | 24,171 |
pythondev | help | So, the main `for` loop is looking at every possible starting position for `"bob"` in the string. It might be at position 0, 1, all the way up to 3 characters from the end of the string (since you need to have room for `"bob"` left). | 2019-05-17T19:21:29.078100 | Sasha | pythondev_help_Sasha_2019-05-17T19:21:29.078100 | 1,558,120,889.0781 | 24,172 |
pythondev | help | Then if it sees a `"b"` at one of those positions, it enters the inner `for` loop, where it checks each character in `"bob"` for a match. It exits the loop immediately if there's a mismatch, but if it completes the loop successfully, the `else` clause fires, and it increments a counter for how many `"bob"`s it has found. | 2019-05-17T19:22:44.079600 | Sasha | pythondev_help_Sasha_2019-05-17T19:22:44.079600 | 1,558,120,964.0796 | 24,173 |
pythondev | help | (I'm assuming you already know stuff like the `[]` notation for array indexing, etc. But feel free to ask about anything that's unclear. The `for-else` syntax is uncommon in other languages, for instance.) | 2019-05-17T19:25:31.080700 | Sasha | pythondev_help_Sasha_2019-05-17T19:25:31.080700 | 1,558,121,131.0807 | 24,174 |
pythondev | help | nevermind | 2019-05-18T00:45:27.081100 | Brain | pythondev_help_Brain_2019-05-18T00:45:27.081100 | 1,558,140,327.0811 | 24,175 |
pythondev | help | it installs 19.0.3 because even the latest version of python has that version as a constant: <https://github.com/python/cpython/blob/8bba81fd55873148c65b7d0e6a6effbd63048c76/Lib/ensurepip/__init__.py#L13> | 2019-05-18T00:46:23.081300 | Brain | pythondev_help_Brain_2019-05-18T00:46:23.081300 | 1,558,140,383.0813 | 24,176 |
pythondev | help | Thanks I finally get how the program functions. Now if you dont mine could you explain :-
1. For x in range(0,len(s)-len(find)+1)... Why is there +1 in that line of code?
2. For I in range(0, len(find)).... could you please explain more on it
Thank you | 2019-05-18T05:44:23.083300 | Ressie | pythondev_help_Ressie_2019-05-18T05:44:23.083300 | 1,558,158,263.0833 | 24,177 |
pythondev | help | That has to do with how you specify the stopping point for the range. Take a look at the range that's produced with and without the `+1` to see how it's impacted, and it should become a bit more clear | 2019-05-18T09:22:12.083800 | Ashley | pythondev_help_Ashley_2019-05-18T09:22:12.083800 | 1,558,171,332.0838 | 24,178 |
pythondev | help | `len(s)-len(find)+1` produces a number | 2019-05-18T15:50:33.086100 | Hisako | pythondev_help_Hisako_2019-05-18T15:50:33.086100 | 1,558,194,633.0861 | 24,179 |
pythondev | help | so
```
for x in range(0,len(s)-len(find)+1):
```
is similar to
```
end = len(s)-len(find)+1
for x in range(0,end):
``` | 2019-05-18T15:52:01.086300 | Hisako | pythondev_help_Hisako_2019-05-18T15:52:01.086300 | 1,558,194,721.0863 | 24,180 |
pythondev | help | Hi all, I was messing around today creating a Slackbot for my team and it would be amazing if anyone could give any critiques <https://github.com/KaluMba/Slackbot> | 2019-05-18T17:35:11.088000 | Darnell | pythondev_help_Darnell_2019-05-18T17:35:11.088000 | 1,558,200,911.088 | 24,181 |
pythondev | help | hello all I was wondering what funtion could I use in a tkinter window to basicly have a console | 2019-05-18T21:18:52.089000 | Rodrick | pythondev_help_Rodrick_2019-05-18T21:18:52.089000 | 1,558,214,332.089 | 24,182 |
pythondev | help | Like when I do `print("Hello")` in the console it would show print | 2019-05-18T21:19:44.089800 | Rodrick | pythondev_help_Rodrick_2019-05-18T21:19:44.089800 | 1,558,214,384.0898 | 24,183 |
pythondev | help | how do I do that | 2019-05-18T21:19:50.090000 | Rodrick | pythondev_help_Rodrick_2019-05-18T21:19:50.090000 | 1,558,214,390.09 | 24,184 |
pythondev | help | I hate to @ people but <@Sasha> didn't you work with tkinter or am I mislead? | 2019-05-18T21:20:45.090800 | Rodrick | pythondev_help_Rodrick_2019-05-18T21:20:45.090800 | 1,558,214,445.0908 | 24,185 |
pythondev | help | I have before, yeah, and actually I implemented a console-ish feature in an app. As I recall, I did it with a textarea UI element which got updated with new contents via a function call. I'm not aware of any built-in way to just redirect `print` output to a window automatically, though there's probably a library out there which does that. | 2019-05-18T22:05:31.092800 | Sasha | pythondev_help_Sasha_2019-05-18T22:05:31.092800 | 1,558,217,131.0928 | 24,186 |
pythondev | help | Yeah, there's a decent amount of coverage of this topic out there, for instance: <https://www.blog.pythonlibrary.org/2014/07/14/tkinter-redirecting-stdout-stderr/> | 2019-05-18T22:11:55.093400 | Sasha | pythondev_help_Sasha_2019-05-18T22:11:55.093400 | 1,558,217,515.0934 | 24,187 |
pythondev | help | I'm currently setting up an API proxy. I'm planning to use tokens as a security measure for authorizing HTTPS requests. Do I pass these tokens in the header of my requests? | 2019-05-19T00:13:57.095900 | Conchita | pythondev_help_Conchita_2019-05-19T00:13:57.095900 | 1,558,224,837.0959 | 24,188 |
pythondev | help | What is best practice? | 2019-05-19T00:14:20.096200 | Conchita | pythondev_help_Conchita_2019-05-19T00:14:20.096200 | 1,558,224,860.0962 | 24,189 |
pythondev | help | <https://github.com/KaluMba/Slackbot/blob/master/Slackbot.py#L27-L29>
Strange use of `pathlib` here. You don't need to cast `Path.home` to `str` right away, you can instead construct the path you need like `Path.home() / 'Credentials' / 'slack.json'` and then convert it to `str` | 2019-05-19T02:08:46.096400 | Chester | pythondev_help_Chester_2019-05-19T02:08:46.096400 | 1,558,231,726.0964 | 24,190 |
pythondev | help | Why you need `pandas` to read the json? It is a huge overkill, python has `json` module built-in | 2019-05-19T02:09:29.096700 | Chester | pythondev_help_Chester_2019-05-19T02:09:29.096700 | 1,558,231,769.0967 | 24,191 |
pythondev | help | <https://github.com/KaluMba/Slackbot/blob/master/Slackbot.py#L27-L29>
Here you could just call `self._refresh_ims()` instead of duplicating the code | 2019-05-19T02:10:17.096900 | Chester | pythondev_help_Chester_2019-05-19T02:10:17.096900 | 1,558,231,817.0969 | 24,192 |
pythondev | help | <https://github.com/KaluMba/Slackbot/blob/master/Slackbot.py#L55>
This looks like `_get_im_ID` method as well | 2019-05-19T02:11:12.097100 | Chester | pythondev_help_Chester_2019-05-19T02:11:12.097100 | 1,558,231,872.0971 | 24,193 |
pythondev | help | <https://github.com/KaluMba/Slackbot/blob/master/Slackbot.py#L98-L99>
This isn't a good way to deal with errors. You should really define and throw a custom exception here | 2019-05-19T02:12:29.097400 | Chester | pythondev_help_Chester_2019-05-19T02:12:29.097400 | 1,558,231,949.0974 | 24,194 |
pythondev | help | Because otherwise the user gets a wild `AssertionError` back - not very helpful. Also, you can run python with optimizations that turn runtime assertions off, so you won't even get any error | 2019-05-19T02:13:16.097700 | Chester | pythondev_help_Chester_2019-05-19T02:13:16.097700 | 1,558,231,996.0977 | 24,195 |
pythondev | help | <@Conchita> <https://swagger.io/docs/specification/authentication/bearer-authentication/> | 2019-05-19T02:14:53.098000 | Chester | pythondev_help_Chester_2019-05-19T02:14:53.098000 | 1,558,232,093.098 | 24,196 |
pythondev | help | Hi everyone,
I am facing a problem and I would need some help on solving it.
I have the following data structure (a list of lists):
```
[
["BLUE", "XXL", 98],
["BLUE", "XL", 97],
["BLUE", "L", 99],
["BLUE", "M", 103],
["PINK", "XXL", 104],
["PINK", "XL", 103],
["PINK", "L", 102],
["PINK", "M", 100],
["RED", "XXL", 99],
["RED", "XL", 102],
["RED", "L", 109],
["RED", "M", 95],
]
```
Where the first element of the list is a color, the second element of the list is a size and the third element of the list is a number.
Is it possible to create a JSON format from this list like the following:
```
{
"BLUE": {
"XXL": 98,
"XL": 97,
"L": 99,
"M": 103
},
"PINK": {
"XXL": 104,
"XL": 103,
"L": 102,
"M": 100
},
"RED": {
"XXL": 99,
"XL": 102,
"L": 109,
"M": 95
}
}
``` | 2019-05-19T05:03:21.101500 | Maryjo | pythondev_help_Maryjo_2019-05-19T05:03:21.101500 | 1,558,242,201.1015 | 24,197 |
pythondev | help | If you are sure that the length of the inner `list` is going to be always 3 I would do something like this:
```
from collections import defaultdict
def json_from_arr(arr):
json = defaultdict(dict)
for row in arr:
[color, size, n] = row
d[color][size] = n
return dict(json)
```
then simply
```
data = [
["BLUE", "XXL", 98],
["BLUE", "XL", 97],
["BLUE", "L", 99],
["BLUE", "M", 103],
["PINK", "XXL", 104],
["PINK", "XL", 103],
["PINK", "L", 102],
["PINK", "M", 100],
["RED", "XXL", 99],
["RED", "XL", 102],
["RED", "L", 109],
["RED", "M", 95],
]
json_from_arr(data)
print(json_from_arr(data))
>>> {'BLUE': {'XXL': 98, 'XL': 97, 'L': 99, 'M': 103}, 'PINK': {'XXL': 104, 'XL': 103, 'L': 102, 'M': 100}, 'RED': {'XXL': 99, 'XL': 102, 'L': 109, 'M': 95}}
``` | 2019-05-19T05:21:58.103200 | Berenice | pythondev_help_Berenice_2019-05-19T05:21:58.103200 | 1,558,243,318.1032 | 24,198 |
pythondev | help | <@Berenice> Thank you very much for your answer. I didn't think of using collections. This is what I was looking for. Some times the length of the inner list will be 2 but I can adjust your code to work. Thanks again! | 2019-05-19T05:24:46.105500 | Maryjo | pythondev_help_Maryjo_2019-05-19T05:24:46.105500 | 1,558,243,486.1055 | 24,199 |
pythondev | help | Hurray for the standard library :confetti_ball: | 2019-05-19T05:26:34.106200 | Berenice | pythondev_help_Berenice_2019-05-19T05:26:34.106200 | 1,558,243,594.1062 | 24,200 |
pythondev | help | :joy: | 2019-05-19T05:26:55.106400 | Maryjo | pythondev_help_Maryjo_2019-05-19T05:26:55.106400 | 1,558,243,615.1064 | 24,201 |
pythondev | help | <@Maryjo> sorry I got curious about the variable length problem and I found this solution:
```
def nested_set(nested_dict, path):
[key, *rest] = path
if len(rest) == 1:
nested_dict[key] = rest[0]
return nested_dict
return nested_set(nested_dict[key], rest)
def json_from_arr(arr):
nest = lambda: defaultdict(nest)
json = nest()
for row in arr:
nested_set(json, row)
return dict(json)
```
It is not that good so if you find something better let me know! | 2019-05-19T05:49:31.107800 | Berenice | pythondev_help_Berenice_2019-05-19T05:49:31.107800 | 1,558,244,971.1078 | 24,202 |
pythondev | help | Btw, props <https://stackoverflow.com/a/8702435> for the nested defaultdict trick. | 2019-05-19T05:50:31.108100 | Berenice | pythondev_help_Berenice_2019-05-19T05:50:31.108100 | 1,558,245,031.1081 | 24,203 |
pythondev | help | I didn't deal with the variable length problem yet because I am using this JSON structure in a Django template and I am trying to create a table from it. Soon, I will look into the variable length issue and revert with my solution. Thanks again <@Berenice> | 2019-05-19T05:52:26.108300 | Maryjo | pythondev_help_Maryjo_2019-05-19T05:52:26.108300 | 1,558,245,146.1083 | 24,204 |
pythondev | help | I am using Py3.6 Conda Version. Is it possible to install Py3.7 in parallel? | 2019-05-19T06:21:12.109300 | Maegan | pythondev_help_Maegan_2019-05-19T06:21:12.109300 | 1,558,246,872.1093 | 24,205 |
pythondev | help | <@Maegan> how did you install py3.6 on conda? | 2019-05-19T06:23:06.109700 | Chester | pythondev_help_Chester_2019-05-19T06:23:06.109700 | 1,558,246,986.1097 | 24,206 |
pythondev | help | Knowing how to ask a good question is a highly invaluable skill that will benefit you greatly in any career. Two good resources for suggestions and strategies to help you structure and phrase your question to make it easier for those here to understand your problem and help you work to a solution are:
• <https://www.mikeash.com/getting_answers.html>
• <https://stackoverflow.com/help/how-to-ask>
| 2019-05-19T06:32:23.110600 | Leana | pythondev_help_Leana_2019-05-19T06:32:23.110600 | 1,558,247,543.1106 | 24,207 |
pythondev | help | that was an upgrade. I tried something similar so it screwed `conda` command now, I now wiped out anaconda all the way and doing a fresh install | 2019-05-19T06:48:34.111300 | Maegan | pythondev_help_Maegan_2019-05-19T06:48:34.111300 | 1,558,248,514.1113 | 24,208 |
pythondev | help | Have you tried to read `conda --help` or the official docs? | 2019-05-19T06:49:34.111500 | Chester | pythondev_help_Chester_2019-05-19T06:49:34.111500 | 1,558,248,574.1115 | 24,209 |
pythondev | help | Specifically about `conda install` | 2019-05-19T06:49:51.111700 | Chester | pythondev_help_Chester_2019-05-19T06:49:51.111700 | 1,558,248,591.1117 | 24,210 |
pythondev | help | Can someone help me translate those wget/curl commands to python?
<https://docs.netgate.com/pfsense/en/latest/backup/remote-config-backup.html> | 2019-05-19T07:15:46.112500 | Karen | pythondev_help_Karen_2019-05-19T07:15:46.112500 | 1,558,250,146.1125 | 24,211 |
pythondev | help | the command `conda` was not being discovered after the upgrade. | 2019-05-19T07:45:39.112600 | Maegan | pythondev_help_Maegan_2019-05-19T07:45:39.112600 | 1,558,251,939.1126 | 24,212 |
pythondev | help | Then you need to install `conda` first :slightly_smiling_face: | 2019-05-19T07:50:18.112800 | Chester | pythondev_help_Chester_2019-05-19T07:50:18.112800 | 1,558,252,218.1128 | 24,213 |
pythondev | help | <@Karen> use the Session class from the requests library. It's very easy to work with and manages the session cookies for you | 2019-05-19T09:49:58.114100 | Ashley | pythondev_help_Ashley_2019-05-19T09:49:58.114100 | 1,558,259,398.1141 | 24,214 |
pythondev | help | So this is not Python but regex (and i know i just gave someone a ding :wink: )
I am trying to send some markdown files from one server to another. the markdown files have relative img paths. i want to prepend the domain of the first server to the domain, however i am not certain that all links follow this logic.
My thought was having a a regex that gets all links that doesn't start with `https?:` (so `http:` or `https:`) .. but not sure how i would easily search and replace as well. any ideas you lovely people? | 2019-05-19T09:58:59.119300 | Christina | pythondev_help_Christina_2019-05-19T09:58:59.119300 | 1,558,259,939.1193 | 24,215 |
pythondev | help | <@Ashley> can you give me some examples | 2019-05-19T10:23:56.120200 | Karen | pythondev_help_Karen_2019-05-19T10:23:56.120200 | 1,558,261,436.1202 | 24,216 |
pythondev | help | <@Karen> they have a bunch in their docs | 2019-05-19T10:28:17.120400 | Ashley | pythondev_help_Ashley_2019-05-19T10:28:17.120400 | 1,558,261,697.1204 | 24,217 |
pythondev | help | <@Christina> so there's links in these files that have the protocol on them and you're looking to find them all? | 2019-05-19T10:29:18.121500 | Ashley | pythondev_help_Ashley_2019-05-19T10:29:18.121500 | 1,558,261,758.1215 | 24,218 |
pythondev | help | ish? i have both this occurrence `[example](<http://example.org>)` as well as `[foo](/test.pdf)`.
i want to convert `[foo](/test.pdf)` -> `[foo](<http://mydomain.org/test.pdf>)` but leave the <http://example.org|example.org> alone | 2019-05-19T10:32:05.123500 | Christina | pythondev_help_Christina_2019-05-19T10:32:05.123500 | 1,558,261,925.1235 | 24,219 |
pythondev | help | The easiest solution might be going for the syntax first | 2019-05-19T10:36:35.124200 | Ashley | pythondev_help_Ashley_2019-05-19T10:36:35.124200 | 1,558,262,195.1242 | 24,220 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.