Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for mcp
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #288068 |
Post edited: Revert to edit #4 |
— | about 1 year ago |
Edit | Post #288883 |
Post edited: Add headers |
— | over 1 year ago |
Edit | Post #288883 | Initial revision | — | over 1 year ago |
Question | — |
Can pandas be used as a database backend for persistent storage? Question What is the current state of the art database app? How does it compare to SQL? Can pandas be used in place of either? If not, is there something that bridges the gap between SQL and pandas or the current state of the art? Context I have become proficient in pandas and have come to... (more) |
— | over 1 year ago |
Edit | Post #288857 |
Post edited: Remove duplicates in all methods for consistency and update timings |
— | over 1 year ago |
Edit | Post #288857 |
Post edited: Fix grammar and reference Tried |
— | over 1 year ago |
Edit | Post #288857 | Initial revision | — | over 1 year ago |
Answer | — |
A: Remove entries by two-column ID everywhere, that meet a condition somewhere Answer After re-encountering this problem and searching for a solution with a less generic "pandas check if column pair is found in other df" (forgetting I had previously encountered this problem altogether), I found some inspiration that led me to a solid solution. It is fastest, and most c... (more) |
— | over 1 year ago |
Comment | Post #288074 |
The problem with this answer is that it will remove cells in every die, when it should only remove cells identified within that die.
With your answer, if I find that die 1, cell 9 is bad, I will also be removing die 2, cell 9, which may not be bad. (more) |
— | over 1 year ago |
Edit | Post #288068 |
Post edited: Make title more accurate |
— | over 1 year ago |
Edit | Post #288068 |
Post edited: Remove redundant "this" |
— | over 1 year ago |
Edit | Post #288068 |
Post edited: Switch order of sanity check for more sane check |
— | over 1 year ago |
Edit | Post #288068 | Initial revision | — | over 1 year ago |
Question | — |
Remove entries by two-column ID everywhere, that meet a condition somewhere MWE ```py import random import pandas as pd from itertools import product random.seed(12345) dies = [1, 2] cells = list(range(10)) currents = [100, 200, 300] dcc = list(product(dies, cells, currents)) resistances = random.choices(range(250000 + 1), k=len(dcc)) df = pd.DataFra... (more) |
— | over 1 year ago |
Comment | Post #287884 |
It's a good question. I would expect there to be a parameter for this in the `mean()` function. (more) |
— | over 1 year ago |
Edit | Post #287884 | Initial revision | — | almost 2 years ago |
Question | — |
How to compress columns of dataframe by function Problem How can I compress each column of a dataframe to the output of a function (i.e., mean), preserving columns? MWE ```py import pandas as pd data = {"A": [1, 2, 3, 4], "B": [5, 6, 7, 8]} df = pd.DataFrame(data) ``` ``` A B 0 1 5 1 2 6 2 3 7 3 4 8 ``` Desired... (more) |
— | almost 2 years ago |
Comment | Post #287514 |
Built-in to pandas. Pandas tends to be feature complete with respect to R. [Here is the function documentation in R](https://search.r-project.org/CRAN/refmans/goeveg/html/cv.html). (more) |
— | almost 2 years ago |
Edit | Post #287509 | Initial revision | — | almost 2 years ago |
Question | — |
Built-in way to compute coefficient of variation in pandas Background The coefficient of variation is: > defined as the ratio of the standard deviation to the mean Question Is there a built-in function for this? Tried I know I can do `df.std() / df.mean()`. (more) |
— | almost 2 years ago |
Edit | Post #286768 |
Post edited: Add update dates |
— | about 2 years ago |
Edit | Post #286768 |
Post edited: Update |
— | about 2 years ago |
Comment | Post #287314 |
```py
filename = "bad_dir"
raise FileNotFoundError(filename)
``` (more) |
— | about 2 years ago |
Edit | Post #287312 |
Post edited: Make question findable |
— | about 2 years ago |
Edit | Post #287312 | Initial revision | — | about 2 years ago |
Question | — |
How can I provide additional information when raising an exception? Suppose I have some code like: ```py filename = "baddir" print(f"File not found: {filename}.") raise(FileNotFoundError) ``` When the exception isn't caught, the stack trace is printed at the end of the output, right as the program aborts. The `print`ed message could be far above this and is... (more) |
— | about 2 years ago |
Comment | Post #286768 |
Not sure if this was always there, but the drop down to the right of your account lets you jump to other topics! (Would still be nice if "Communities" was clickable.) (more) |
— | over 2 years ago |
Comment | Post #286768 |
Too cool! I can now subscribe to other users! (more) |
— | over 2 years ago |
Comment | Post #286789 |
I meant how do you figure it wouldn't require much manual formatting. (more) |
— | over 2 years ago |
Comment | Post #286789 |
Either way it's going into latex, .png or table. I'm open to both, but only a solution that lets me export to that format without me manually re-entering data. (more) |
— | over 2 years ago |
Comment | Post #286789 |
How do you figure? (more) |
— | over 2 years ago |
Comment | Post #286791 |
Nice, this also works if I store the plot in a variable for saving:
```py
plot = df.plot.bar()
plot = plot.axvline(x=2.5, ymin=0, ymax=1)
plot.get_figure().savefig("busy_bar.png")
``` (more) |
— | over 2 years ago |
Edit | Post #286789 |
Post edited: Add notes header |
— | over 2 years ago |
Edit | Post #286789 |
Post edited: Add note about legibility |
— | over 2 years ago |
Edit | Post #286789 |
Post edited: Add output image |
— | over 2 years ago |
Edit | Post #286789 | Initial revision | — | over 2 years ago |
Question | — |
How to plot table from pandas dataframe MWE ```py import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.DataFrame(np.random.rand(9, 4), columns=['a', 'b', 'c', 'd']) df.plot.bar(table=True) # don't want plot, just want table df.plot.table() # what I would hope plt.show() ``` Busy Bar with Table Q... (more) |
— | over 2 years ago |
Edit | Post #286768 |
Post edited: Add vimium note |
— | over 2 years ago |
Comment | Post #286780 |
https://powerusers.codidact.com/posts/286781 (more) |
— | over 2 years ago |
Comment | Post #286780 |
Because this is so manual, I might consider post-processing in Gimp or similar. (more) |
— | over 2 years ago |
Comment | Post #286780 |
Sounds promising, can you post output? (more) |
— | over 2 years ago |
Edit | Post #286776 |
Post edited: Remove support tag now in right tab (Q&A) |
— | over 2 years ago |
Edit | Post #286776 |
Post edited: Add python tag |
— | over 2 years ago |
Edit | Post #286776 | Initial revision | — | over 2 years ago |
Question | — |
How to add vertical lines for visual separation in pandas plot MWE ```py import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.DataFrame(np.random.rand(9, 4), columns=['a', 'b', 'c', 'd']) df.plot.bar() plt.show() ``` Busy Bar Graph Question How do I add separating vertical lines between groups? Say these are groups o... (more) |
— | over 2 years ago |
Edit | Post #286768 |
Post edited: Add like |
— | over 2 years ago |
Edit | Post #286768 |
Post edited: Make update clear and add other request |
— | over 2 years ago |
Edit | Post #286768 |
Post edited: Add user bookmarking request |
— | over 2 years ago |
Comment | Post #286768 |
Yes the solid "click, unclick" is something I find very pleasing! I like being deliberate and being guided towards explicit actions. Brings confidence and eagerness to my workflow.
For big threads, for sure, take the user to the full context. For one or two comment threads, which is what I've enco... (more) |
— | over 2 years ago |
Edit | Post #286768 |
Post edited: Add url impression |
— | over 2 years ago |