question_id int64 37.6M 73.2M | input_text stringlengths 88 52.4k | output_text stringlengths 37 35.6k | title stringlengths 15 150 | tags stringlengths 1 107 | q_score int64 -19 397 | view_count int64 3 879k | answer_count int64 1 21 | accepted_answer_id int64 37.6M 73.8M | answer_id int64 37.6M 73.8M | a_score int64 -5 1.29k | is_accepted bool 1
class | creation_date stringlengths 20 24 | input_text_instruct stringlengths 251 52.6k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
72,329,230 | why when i give my input field a width of 100 % and margin of 10 for example it doesnt apply the margin?<p>so I'm trying to make the input field like this
<a href="https://i.stack.imgur.com/YDzWS.png" rel="nofollow noreferrer">image to see what I want to expect</a></p>
<p>and for some reason box-sizing:border-box doesn... | <p>You should be doing this:</p>
<pre><code>width: calc(100% - 20px);
</code></pre> | why when i give my input field a width of 100 % and margin of 10 for example it doesnt apply the margin? | css | 1 | 40 | 1 | 72,329,254 | 72,329,254 | 1 | true | 2022-05-21T11:43:31.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
why when i give my input field a width of 100 % and margin of 10 for example it doesnt apply the margin?<p>so I'm trying to make the input field like this
<a... |
72,329,052 | sort row's similar columns and put row other items below the sorted row name<p>Sort rows names and print the corresponding values below them.</p>
<p>text file contains</p>
<pre><code>x 1 asd
x 2 asd
x 3 asd
x 4 asd
x 5 asd
x 5 asd
x 7 asd
b 8 axy
b 9 axc
</code></pre>
<p>output required</p>
<pre><code>x
asd
asd
asd
as... | <p>Here's a way to do it:</p>
<pre class="lang-py prettyprint-override"><code>with open('infile.txt', 'r', encoding="utf-8") as f:
rows = [row.split() for row in f.readlines()]
print('rows:'); print(rows)
column = [rows[0][0]] + [row[-1] for row in rows]
print('column:'); print(column)
wit... | sort row's similar columns and put row other items below the sorted row name | python|python-3.x | 0 | 40 | 2 | 72,329,525 | 72,329,525 | 1 | true | 2022-05-21T11:16:59.240Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
sort row's similar columns and put row other items below the sorted row name<p>Sort rows names and print the corresponding values below them.</p>
<p>text fil... |
72,371,779 | Updating a nested dictionary whose root keys match the index of a certain dataframe with said dataframe’s values<p>I have a nested dict that is uniform throughout (i.e. each 2nd level dict will have the same keys).</p>
<pre><code>{
'0': {'a': 1, 'b': 2},
'1': {'a': 3, 'b': 4},
'2': {'a': 5, 'b': 6},
}
</code></pr... | <p>Try this</p>
<pre class="lang-py prettyprint-override"><code># input
my_dict = {
'0': {'a': 1, 'b': 2},
'1': {'a': 3, 'b': 4},
'2': {'a': 5, 'b': 6},
}
my_df = pd.DataFrame({'c': [9, 6, 4]})
# build df from my_dict
df1 = pd.DataFrame.from_dict(my_dict, orient='index')
# append my_df as a column to df1
df1['c']... | Updating a nested dictionary whose root keys match the index of a certain dataframe with said dataframe’s values | python|pandas|dictionary | 0 | 40 | 1 | 72,371,814 | 72,371,814 | 1 | true | 2022-05-25T03:52:42.570Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Updating a nested dictionary whose root keys match the index of a certain dataframe with said dataframe’s values<p>I have a nested dict that is uniform throu... |
72,320,995 | Data output from the database<p>I have a select and I want to output data from the DB</p>
<pre><code> <select class="select-css" name="title" required="">
<option selected="" value="" disabled="">Выберите сервер</optio... | <p>Assuming the model and migration is correct, the problem lies in query which in this case returning <code>boolean</code> instead of <code>collection</code>, and then foreach in the blade view get passed <code>boolean</code> as an argument instead of <code>collection</code> because of this it will throw an error.</p>... | Data output from the database | php|laravel | 0 | 40 | 1 | 72,325,846 | 72,325,846 | 1 | true | 2022-05-20T14:54:08.933Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Data output from the database<p>I have a select and I want to output data from the DB</p>
<pre><code> <select class="select-css" name... |
72,260,056 | Pandas : Create new column based on text value of another column<p>This might be very simple question, but here's my dataframe:</p>
<pre class="lang-python prettyprint-override"><code> id text position labels
0 39088 skin melanoma [58.0, 71.0] indication
1 39088 pr... | <p>You can use:</p>
<pre><code>out = (df
.drop(columns=['position', 'result.value.labels'])
.join(
df.reset_index().dropna(subset=['result.value.labels'])
.pivot(index='index', columns='result.value.labels', values='position')
.reindex(df.index)
.fillna('[nan, nan]')
.add_suffix('.position')
)
)
<... | Pandas : Create new column based on text value of another column | python|pandas|dataframe | -1 | 40 | 1 | 72,260,244 | 72,260,244 | 1 | true | 2022-05-16T13:31:36.740Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas : Create new column based on text value of another column<p>This might be very simple question, but here's my dataframe:</p>
<pre class="lang-python p... |
72,336,451 | Objectio dB database for Java desktop persistance<p>I have been trying out object ox io for Java. It has been working well on Android hence I decided to go with it on Java desktop implementation.</p>
<p>The problem I am facing is that I can save my data at run time but when I restart the app or desktop app the data is ... | <p>You are creating a new temporary file each time when you execute your application. I guess that explains your problem.</p>
<p>From the docs:</p>
<blockquote>
<p>creates a new empty file in the specified directory. deleteOnExit()
method is called to delete the file created by this method.</p>
</blockquote> | Objectio dB database for Java desktop persistance | java|database|desktop-application|objectbox-java | 0 | 40 | 1 | 72,339,013 | 72,339,013 | 1 | true | 2022-05-22T09:51:22.670Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Objectio dB database for Java desktop persistance<p>I have been trying out object ox io for Java. It has been working well on Android hence I decided to go w... |
72,305,920 | How can i make a single straight line in HTML Canvas which is bound to the input of the mouse<p>I've got a question which i can't seem to figure out the right way. For some context. I'm trying to make a sort of connect the dots game. People can click on a circle and link the circle to the next one. Connecting the dots ... | <p>This code just to help you to use <code>canvas</code>.</p>
<p>I added a start status in the data.</p>
<pre><code>var data = {
start: false, // initial value is false
canvas: null,
ctx: null,
clickedDot: null,
dots: [{
x: 180,
y: 50
}, {
x: 20,
y: 50
}]
};
</code></pre>
<p>And i changed ... | How can i make a single straight line in HTML Canvas which is bound to the input of the mouse | javascript|canvas|html5-canvas | 0 | 40 | 1 | 72,306,889 | 72,306,889 | 1 | true | 2022-05-19T13:57:29.857Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can i make a single straight line in HTML Canvas which is bound to the input of the mouse<p>I've got a question which i can't seem to figure out the righ... |
72,283,174 | Ctypes Data type conversion<p>I am a ctypes beginner using Python 3.9.7 on Windows,I met a problem ,Examples are as follows</p>
<pre><code>n = c_int(10)
print(n)
>> n = c_long(10)
</code></pre>
<p>Why does it become <code>c_long(10)</code> after it is assigned to n</p> | <p>Reproducible on Windows. <code>c_int</code> is an alias for <code>c_long</code> since the size of <code>int</code> and <code>long</code> are both 32-bit on Windows.</p>
<pre><code>Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright&... | Ctypes Data type conversion | python|windows|ctypes | 1 | 40 | 1 | 72,284,458 | 72,284,458 | 1 | true | 2022-05-18T04:21:43.973Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Ctypes Data type conversion<p>I am a ctypes beginner using Python 3.9.7 on Windows,I met a problem ,Examples are as follows</p>
<pre><code>n = c_int(10)
prin... |
72,375,550 | How can I extract (values of yes) in vector from ifelse function<p>I want to extract values of yes in vector only in the ifelse function
for example</p>
<pre><code>X=rnorm(6,1,1)
y<- ifelse(X>0,yes=1,no=2)
#I get
1 1 2 1 1 1
#Also if I use for loop
X<-matrix(rcauchy(15*5,0,1),5)
p<-vector()
for(i... | <p>Maybe you want something like:</p>
<pre><code>set.seed(7)
X <- matrix(rcauchy(15*5,0,1),5)
i <- apply(X, 1, \(y) shapiro.test(y)$p.value>=0.05)
apply(X[i,], 1, \(y) t.test(y, alternative = "two.sided")$p.value)
#[1] 0.5011835 0.6214762 0.0983801
</code></pre>
<hr />
<p>Try.</p>
<pre><code>set.seed... | How can I extract (values of yes) in vector from ifelse function | r | -1 | 40 | 2 | 72,375,616 | 72,375,616 | 1 | true | 2022-05-25T10:00:42.063Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How can I extract (values of yes) in vector from ifelse function<p>I want to extract values of yes in vector only in the ifelse function
for example</p>
<pre... |
72,312,767 | What are the benefits of making a variable permanently a pointer as opposed to only using it as a pointer when needed in C?<p>I was looking through code as reference to a project I am currently working on. I noticed that instead of having a variable and then only casting a pointer to it temporarily to pass it as a para... | <p>Suppose you will need several sprites in your program. You <em>could</em> do something like</p>
<pre><code>Sprite s1;
initSprite(model, &s1, x, y);
Sprite s2;
initSprite(model, &s2, x, y);
Sprite s3;
initSprite(model, &s3, x, y);
</code></pre>
<p>And then later, if you needed a few more, you <em>could</... | What are the benefits of making a variable permanently a pointer as opposed to only using it as a pointer when needed in C? | c|oop|pointers|memory-management | 0 | 40 | 3 | 72,312,826 | 72,312,826 | 1 | true | 2022-05-20T01:52:30.833Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What are the benefits of making a variable permanently a pointer as opposed to only using it as a pointer when needed in C?<p>I was looking through code as r... |
72,388,648 | What is replacement for FullTextQuery.setCriteriaQuery() in Hibernate Search 6?<p>I am migrating Hibernate Search 5 to Hibernate Search 6.
Though, the <a href="https://docs.jboss.org/hibernate/search/6.0/reference/en-US/html_single/#getting-started" rel="nofollow noreferrer">documentation</a> is really helpful, I am no... | <blockquote>
<p>This is the Hibernate Search 5 query that I am trying to convert,</p>
</blockquote>
<p>I'll nitpick a bit: this is not a Hibernate Search 5 query, this is a Hibernate (ORM) Criteria query. Those restrictions are executed against the database, not against the search indexes.</p>
<p>From the title of your... | What is replacement for FullTextQuery.setCriteriaQuery() in Hibernate Search 6? | spring-boot|hibernate|hibernate-search|elasticsearch-7|hibernate-search-6 | 1 | 40 | 1 | 72,431,758 | 72,431,758 | 1 | true | 2022-05-26T08:02:43.493Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is replacement for FullTextQuery.setCriteriaQuery() in Hibernate Search 6?<p>I am migrating Hibernate Search 5 to Hibernate Search 6.
Though, the <a hre... |
72,313,739 | Typed default exports in typescript?<p>I tried searching for this but couldnt find it. I'm trying to do this</p>
<pre><code>import { Variables } from './types';
export default: Variables = {
type: 'set_variables',
variables: {
show_cursor: false,
win_size: 400,
is_text_only: false,
type_time: 0.0... | <p>You can use in this way -</p>
<pre><code>import { Variables } from './types';
const variable: Variables = {
type: 'set_variables',
variables: {
show_cursor: false,
win_size: 400,
is_text_only: false,
type_time: 0.05,
},
};
export default variable;
</code></pre>
<p>Or</p>... | Typed default exports in typescript? | javascript|typescript|export | 1 | 40 | 1 | 72,313,773 | 72,313,773 | 1 | true | 2022-05-20T04:54:52.243Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Typed default exports in typescript?<p>I tried searching for this but couldnt find it. I'm trying to do this</p>
<pre><code>import { Variables } from './typ... |
72,359,348 | add values based on row value<p>I have a code that creates csv files after certain operations with original dataframe:</p>
<pre><code>import pandas as pd
timetable = pd.read_excel('timetable.xlsx')
data = {"stop_id": timetable['stop_id'], "arrival_time": timetable['arrival_time'], 'route_id': time... | <p>quite self explanatory:</p>
<pre><code>import pandas as pd
df = pd.read_excel('timetable.xlsx', converters={'stop_id':int,'route_id':int})
# grouping by stop_id & arrival_time, also joining route_id to the sorted list, counting size of each stop_id group
# all ends up in multi-index dataframe, .reset_index a... | add values based on row value | python|pandas | 0 | 40 | 1 | 72,361,073 | 72,361,073 | 1 | true | 2022-05-24T08:09:54.973Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
add values based on row value<p>I have a code that creates csv files after certain operations with original dataframe:</p>
<pre><code>import pandas as pd
ti... |
72,330,609 | jQuery().detach().appendTo Duplicating all detached elements<p>I'm trying to add some extra divs to the build-in blogs "read more" links. I've managed to add all the necessary div but I'm struggling to move the text from where it is into another div. I've managed to move it using:</p>
<p>'''jQuery(".read... | <p>Do the moves in a third loop.
Something like below should work (untested)
First detach, then Append.</p>
<pre><code>for (i = 0; i < AddButtonWrap.length; i++)
{
var readMore = jQuery(AddButtonWrap[i]).find(".readmore").detach();
readMore.appendTo(jQuery(AddButtonWrap[i]).find(".js-add-btn-a... | jQuery().detach().appendTo Duplicating all detached elements | javascript|html|jquery|append|detach | 1 | 40 | 1 | 72,330,812 | 72,330,812 | 1 | true | 2022-05-21T14:48:55.033Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
jQuery().detach().appendTo Duplicating all detached elements<p>I'm trying to add some extra divs to the build-in blogs "read more" links. I've mana... |
72,250,637 | How to calculate the correlation of 2 variables for every nth rows in a data frame in r?<p>I have a data frame of 200*1000 rows and 6 columns. I want to calculate the correlation between 2 columns <code>cor(df$y1, df$y2))</code> for every 200 rows, so that I get 1000 different correlation values as a result.
When I wan... | <p>We may use a group by approach</p>
<pre><code>by(df[c('y1', 'y2')], as.integer(gl(nrow(df), 200, nrow(df))),
FUN = function(x) cor(x$y1, x$y2))
</code></pre>
<hr />
<p>Or using <code>tidyverse</code></p>
<pre><code>library(dplyr)
out <- df %>%
group_by(grp = as.integer(gl(n(), 200, n()))) %>%
su... | How to calculate the correlation of 2 variables for every nth rows in a data frame in r? | r|dataframe|correlation | 1 | 40 | 1 | 72,250,669 | 72,250,669 | 2 | true | 2022-05-15T17:31:08.157Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to calculate the correlation of 2 variables for every nth rows in a data frame in r?<p>I have a data frame of 200*1000 rows and 6 columns. I want to calc... |
72,252,525 | How to add options to an HTML Table using Apps Script?<p>I was wondering how I could add these options to an HTML table within Apps Script Editor.</p>
<p>Here's the script:</p>
<pre><code>function doGet() {
return HtmlService.createTemplateFromFile('Index').evaluate();
}
/* PROCESS FORM */
function processForm(formO... | <p>From <code>I've tried it above but the page is empty.</code>, if your are using your showing script, I think that your script is incomplete. So, please modify as follows and test it again.</p>
<h3>From:</h3>
<pre><code> "<option value='audi'>Audi</option>" +
"</select></td>
... | How to add options to an HTML Table using Apps Script? | html|google-apps-script | 1 | 40 | 1 | 72,253,031 | 72,253,031 | 2 | true | 2022-05-15T22:04:54.660Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to add options to an HTML Table using Apps Script?<p>I was wondering how I could add these options to an HTML table within Apps Script Editor.</p>
<p>Her... |
72,256,496 | How to fix problems with displaying verbatim tag in YAML?<p>I have a problem with dumping a YAML file with the verbatim tag. How can I fix the encoding problem?<br />
I try to dump YAML by this way</p>
<pre class="lang-py prettyprint-override"><code>import sys
from ruamel.yaml import YAML
class Entry:
yaml_tag = '... | <p>There is currently no way to work with absolute tags. <code>ruamel.yaml</code> can read them but not dump them.</p>
<p>I suggest you postprocess the output to revert the encoded tag start and end, which is relatively easy:</p>
<pre class="lang-py prettyprint-override"><code>import sys
from ruamel.yaml import YAML
c... | How to fix problems with displaying verbatim tag in YAML? | python|ruamel.yaml | 2 | 40 | 1 | 72,256,797 | 72,256,797 | 2 | true | 2022-05-16T08:51:57.420Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to fix problems with displaying verbatim tag in YAML?<p>I have a problem with dumping a YAML file with the verbatim tag. How can I fix the encoding probl... |
72,264,863 | Return most common value in column by group, replace null in that column with that value<p>I'd like to replace the na values in my df column with the most common value by group</p>
<pre><code>#Ex:
df <- data.frame(Home_Abbr = c('PHI', 'PHI', 'DAL', 'PHI'),
Home_City = c('Philadelphia', 'Philadelphi... | <p>We can use <a href="https://stackoverflow.com/questions/31400445/r-how-to-find-the-mode-of-a-vector"><code>Mode</code></a> function</p>
<pre><code> Mode <- function(x) {
ux <- unique(x)
ux[which.max(tabulate(match(x, ux)))]
}
</code></pre>
<p>and then <code>replace</code></p>
<pre><code>library(dplyr)
df %... | Return most common value in column by group, replace null in that column with that value | r|dplyr | 2 | 40 | 1 | 72,264,895 | 72,264,895 | 2 | true | 2022-05-16T19:53:25.530Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Return most common value in column by group, replace null in that column with that value<p>I'd like to replace the na values in my df column with the most co... |
72,265,697 | Python Categorizing Dataframe columns based on part of the colomn name<p><strong>Reproducible data:</strong></p>
<pre><code>import random
data = {'test_1_a':random.sample(range(1, 50), 7),
'test_1_b':random.sample(range(1, 50), 7),
'test_1_c':random.sample(range(1, 50), 7),
'test_2_a':random.sam... | <p>Let's keep track of the different families in a dictionary, the keys being the letters (the families) and the values being lists holding the columns from a certain family.</p>
<p>Since we know that each column ends with a letter related with its family, we can use that as a key in the dictionary.</p>
<pre class="lan... | Python Categorizing Dataframe columns based on part of the colomn name | python|pandas|numpy|dictionary | 0 | 40 | 3 | 72,265,847 | 72,265,847 | 2 | true | 2022-05-16T21:13:50.450Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python Categorizing Dataframe columns based on part of the colomn name<p><strong>Reproducible data:</strong></p>
<pre><code>import random
data = {'test_1... |
72,273,433 | Eclipse external dependencies for Spring Boot - why doesn't it show all dependencies for Spring boot for a given project?<p>I'm trying to figure out if any of our spring-boot projects use spring-cloud, which has a recently discovered exploit.</p>
<p>I know spring-boot comes with spring-cloud as a dependency, but when I... | <p><code>spring-boot-autoconfigure</code> mainly has <code>optional</code> dependencies and those are never transitivly and automatically included in projects that use <code>spring-boot-autoconfigure</code>. How <a href="https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.htm... | Eclipse external dependencies for Spring Boot - why doesn't it show all dependencies for Spring boot for a given project? | spring-boot|maven|dependencies | 0 | 40 | 1 | 72,275,546 | 72,275,546 | 2 | true | 2022-05-17T11:42:36.527Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Eclipse external dependencies for Spring Boot - why doesn't it show all dependencies for Spring boot for a given project?<p>I'm trying to figure out if any o... |
72,259,544 | The 'R2jags::autojags()' Function Doesn't Converge<p>I'm running the following code:</p>
<pre><code>Data_Frame <- structure(list(Predictor_Variable = c(20.5273283761926, 11.4039835403673, 5.31423215288669, 12.5192134582903, 15.8487716107629, 7.16369490255602, 3.91227747895755, 8.90797802712768, 14.1797202872112, 4.8... | <p>This is what the code for <code>autojags()</code> looks like. We'll go through to see how it works:</p>
<ol>
<li>update the object using the thinning and iterations you indicate in the function call.</li>
</ol>
<pre class="lang-r prettyprint-override"><code> n.burnin = object$n.iter
n.thin.auto <- max(1, f... | The 'R2jags::autojags()' Function Doesn't Converge | r|bayesian|jags|r2jags | 0 | 40 | 1 | 72,281,411 | 72,281,411 | 2 | true | 2022-05-16T12:52:46.417Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
The 'R2jags::autojags()' Function Doesn't Converge<p>I'm running the following code:</p>
<pre><code>Data_Frame <- structure(list(Predictor_Variable = c(20... |
72,281,909 | Inheritance - are you supposed to use base classes, or are they just a framework for child classes?<p>Sorry if this has been asked before. I haven't found a distinct answer.</p>
<p>I have two classes, motorbike and car. The only difference is number of wheels and number of passengers allowed.</p>
<p>In this case, would... | <p>Generally, inheritance is used to model an "isA" relationship.</p>
<p>A car has similar parts to two motorbikes, but a car is <em>not</em> a motorbike.</p>
<p>Both cars and motorbikes, however, are vehicles.</p>
<p>So if it were me, I would use a vehicle class as a base class, and derive both car and motor... | Inheritance - are you supposed to use base classes, or are they just a framework for child classes? | c#|inheritance | 0 | 40 | 2 | 72,281,937 | 72,281,937 | 2 | true | 2022-05-18T00:04:40.560Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Inheritance - are you supposed to use base classes, or are they just a framework for child classes?<p>Sorry if this has been asked before. I haven't found a ... |
72,280,723 | Is it reasonable to abstract out database tables?<p>I maintain an app that has many modules. Each of these modules can have comments on its items. For example, an "Assessments" module which contains assessments, a "Projects" module which contains projects, and a "Findings" module which con... | <p>I don't think you've carried out a thorough enough needs analysis yet/a single <code>comment</code> field seems inadequate to capture why business users typically record comments. But if it's q's for probing the design you're looking for:</p>
<p>How are the <code>id</code>s generated? Are they unique across all modu... | Is it reasonable to abstract out database tables? | database-design|relational-database | -2 | 40 | 1 | 72,282,195 | 72,282,195 | 2 | true | 2022-05-17T21:12:05.007Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it reasonable to abstract out database tables?<p>I maintain an app that has many modules. Each of these modules can have comments on its items. For exampl... |
72,284,732 | Combining Lists According to Index<p>With the following lists:</p>
<pre><code>A=['q','r','s']
B=[0,4,0]
C=[0,0,0]
</code></pre>
<p>The desired output is:</p>
<pre><code>D=['q',0,0,'r',4,0,'s',0,0]
</code></pre>
<p>My attempted solution:</p>
<pre><code>D=[]
for i in B:
D.append(A[B.index(i)])
D.append(B[B.index(... | <p>This should work</p>
<pre><code># use zip function to traverse all 5 lists together
# use a nested loop to flatten the tuples created by zip
[e for x in zip(A, B, C, D, E) for e in x]
# ['asd', 1, 'ttt', 1, 0, 'qwe', 2, 'ttt', 2, 30, 'wer', 3, 'ttt', 5, 0]
</code></pre> | Combining Lists According to Index | python|list|loops|append | 0 | 40 | 3 | 72,285,480 | 72,285,480 | 2 | true | 2022-05-18T07:20:15.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Combining Lists According to Index<p>With the following lists:</p>
<pre><code>A=['q','r','s']
B=[0,4,0]
C=[0,0,0]
</code></pre>
<p>The desired output is:</p>... |
72,290,106 | PostgreSQL: Dirtied blocks when using many OR conditions in query<p>I'm using PostgreSQL 13.7.</p>
<p>When trying to optimize a query that is made of several sub-queries, I noticed that reducing the number of OR clauses in the final part significantly improves performance (800ms to 70ms). The part in question is this (... | <p>The real problem with your performance is just-in-time compilation. It dominates your run time in both queries. Turn jit off. Then if you still have a question left, post the new plans after jit is turned off. (The plans probably won't change, but the timings will).</p>
<p>Also, repeat the queries in both orders... | PostgreSQL: Dirtied blocks when using many OR conditions in query | postgresql|postgresql-13|query-planner | 0 | 40 | 1 | 72,290,673 | 72,290,673 | 2 | true | 2022-05-18T13:27:14.300Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
PostgreSQL: Dirtied blocks when using many OR conditions in query<p>I'm using PostgreSQL 13.7.</p>
<p>When trying to optimize a query that is made of several... |
72,291,704 | Is it possible to auto-size the subsequent input of a layer following torch.nn.Flatten within torch.nn.Sequential in PyTorch?<p>If I have the following model class for example:</p>
<pre><code>class MyTestModel(nn.Module):
def __init__(self):
super(MyTestModel, self).__init__()
self.seq1 = nn.Seque... | <p>PyTorch (>=1.8) has <a href="https://pytorch.org/docs/stable/generated/torch.nn.LazyLinear.html" rel="nofollow noreferrer">LazyLinear</a> which infers the input dimension.</p> | Is it possible to auto-size the subsequent input of a layer following torch.nn.Flatten within torch.nn.Sequential in PyTorch? | python|machine-learning|neural-network|pytorch | 3 | 40 | 1 | 72,291,816 | 72,291,816 | 2 | true | 2022-05-18T15:09:14.703Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to auto-size the subsequent input of a layer following torch.nn.Flatten within torch.nn.Sequential in PyTorch?<p>If I have the following model... |
72,295,966 | Multiply one dataframe by each row in another dataframe and aggregate result<p>I have one dataframe where each row contain weights. I want to multiply a second dataframe by each row of the first one and aggregate the results with rowsumS then cumprod. For each line in the first dataframe, I want to save one element as ... | <p>Any of the following would work:</p>
<p>Base R:</p>
<pre><code>apply(tcrossprod(y, x) + 1, 2, prod)
[1] 0.3222529 0.1435537 -0.3998603 -2.1293011
</code></pre>
<p>Using <code>matrixStats</code>:</p>
<pre><code>matrixStats::rowProds(tcrossprod(x, y) + 1)
[1] 0.3222529 0.1435537 -0.3998603 -2.1293011
matrixStats:... | Multiply one dataframe by each row in another dataframe and aggregate result | r|dataframe|tidyverse | 0 | 40 | 1 | 72,296,118 | 72,296,118 | 2 | true | 2022-05-18T21:04:05.377Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Multiply one dataframe by each row in another dataframe and aggregate result<p>I have one dataframe where each row contain weights. I want to multiply a seco... |
72,291,394 | Should I remove confidential files at the end of a GitHub Action workflow?<p>I have some actions where I need to store a secret into a file. This secret is used by another job later, like:</p>
<pre><code>env:
FIREBASE_DISTRIBUTION_KEY: ${{ secrets.GCP_SA_FIREBASE_DISTRIBUTION_PROD_KEY }}
run: |
echo $FIREBASE_DISTR... | <p>This is not necessary.</p>
<p>First, GitHub Actions runners are not containers, they're virtual machines. There's no opportunity for container escape, and there's no notion of "cleaning up" the containers.</p>
<p>The virtual machine is disposed of completely. Neither the virtual machine that ran your job -... | Should I remove confidential files at the end of a GitHub Action workflow? | security|github|github-actions | 0 | 40 | 1 | 72,297,690 | 72,297,690 | 2 | true | 2022-05-18T14:49:08.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Should I remove confidential files at the end of a GitHub Action workflow?<p>I have some actions where I need to store a secret into a file. This secret is u... |
72,299,396 | Check Input as its being typed ReactJS<p>I would like to check an input as it's being typed, without pressing a key or a button asynchronously.I would like to set a variables value to true if a person has typed more than 4 letters.</p>
<p>I think it would also be fine if the value sets to true <em>(if the value is 4 or... | <p>You need <a href="https://reactjs.org/docs/forms.html#controlled-components" rel="nofollow noreferrer">controlled components</a>(controlled input). Here is my version using hooks. You get the number of symbols entered in <code>count</code> variable.</p>
<pre><code>import "./styles.css";
import { useState }... | Check Input as its being typed ReactJS | javascript|reactjs | 1 | 40 | 4 | 72,299,458 | 72,299,458 | 2 | true | 2022-05-19T06:06:46.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Check Input as its being typed ReactJS<p>I would like to check an input as it's being typed, without pressing a key or a button asynchronously.I would like t... |
72,307,058 | Is there a css selector to take into account parent class?<p>I am creating a react e-commerce app where I need to use the same component for a cart, that takes the whole screen, and for a dropdown menu with the cart, that is much smaller.</p>
<p>What I want to do is to pass a class as prop when I'm rendering the dropdo... | <p>The CSS solution is to just redefine the styles for the elements when in the context of the overlay:</p>
<pre><code>.cart-element{
font-size:1rem;
}
.cart-button{
padding:0.5rem 1rem;
}
.cart-overlay{
.cart-element{
font-size:0.8rem;
}
.cart-button{
padding:0.25rem 1rem;
}
}
</code></pre>
<p>Th... | Is there a css selector to take into account parent class? | javascript|css|reactjs | 1 | 40 | 1 | 72,307,411 | 72,307,411 | 2 | true | 2022-05-19T15:14:08.177Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a css selector to take into account parent class?<p>I am creating a react e-commerce app where I need to use the same component for a cart, that tak... |
72,302,721 | How to compute Kramers-Moyal coefficients when the time step is not to small in Python?<p>I am coding a simple one-dimensional Ornstein-Uhlenbeck simulation in <code>python</code> to explain some experimental data from a video source, i.e., tracking a brownian particle in a sequence of frames. The sampling frequency of... | <p><strong>tl;dr</strong>: Add the correction to the diffusion as</p>
<pre><code>D₂(x) = (M₂(x) - (M₁(x)²)/2)/dt
</code></pre>
<p>or using the <code>kmc</code> in your notation</p>
<pre><code>sigma_est = np.sqrt(2 * (kmc[1] - 0.5*kmc[0]**2) / dt[i])
</code></pre>
<hr />
<p>This is actually a known "issue", wh... | How to compute Kramers-Moyal coefficients when the time step is not to small in Python? | python|numpy|simulation|stochastic | 1 | 40 | 1 | 72,310,829 | 72,310,829 | 2 | true | 2022-05-19T10:13:19.610Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to compute Kramers-Moyal coefficients when the time step is not to small in Python?<p>I am coding a simple one-dimensional Ornstein-Uhlenbeck simulation ... |
72,314,605 | Pandas Check two data frame columns and access third value<p>I am very beginner to pandas though I solved same case with comparison
here is data frame I was working</p>
<pre><code>s= [
{
'from':0,
'to':400000000,
'value':0.01
},
{
'from':400000001,
'to':500000... | <p>I think correct way is with <a href="http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.loc.html" rel="nofollow noreferrer"><code>DataFrame.loc</code></a> for select column by mask, also is change <code><=</code> from <code><</code> for second condition:</p>
<pre><code>s = df.loc[(df['f... | Pandas Check two data frame columns and access third value | python|pandas|dataframe | 2 | 40 | 2 | 72,314,732 | 72,314,732 | 2 | true | 2022-05-20T06:41:44.690Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas Check two data frame columns and access third value<p>I am very beginner to pandas though I solved same case with comparison
here is data frame I wa... |
72,325,354 | How would I add multiple attributes together and store them in another attribute in Object Oriented Programming in Python?<p>Below is 1/4th of a class I am working on with multiple methods, I am struggling trying to figure out how to add all my attributes together and return them to the attribute total investment. I un... | <p>Replace</p>
<pre class="lang-py prettyprint-override"><code>return self.rent + self.laundry + self.storage + self.miscellaneousincome ==
self.totalmonthlyincome
</code></pre>
<p>with</p>
<pre class="lang-py prettyprint-override"><code>self.totalmonthlyincome = self.rent + self.laundry + self.storage + self.miscel... | How would I add multiple attributes together and store them in another attribute in Object Oriented Programming in Python? | python|oop | 1 | 40 | 2 | 72,325,386 | 72,325,386 | 2 | true | 2022-05-20T22:37:34.527Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How would I add multiple attributes together and store them in another attribute in Object Oriented Programming in Python?<p>Below is 1/4th of a class I am w... |
72,329,297 | Split a dataframe according to priorities and specific number of rows<p>I want to split a dataframe into 3 new dataframes according to a priority column. My dataframe is as follows:</p>
<pre><code> City Priority
0 New York 3
1 Paris 1
2 Boston 7
3 La Habana ... | <p>IIUC this should work as expected:</p>
<p>(1) you create a column <code>bin_Priority</code> which applies each row to the right bin, the labels of the bins are the priority in which order to look for them.</p>
<p>(2) <code>sort_values</code> on <code>bin_Priority</code>, then in each bin on <code>Priority</code>.</p... | Split a dataframe according to priorities and specific number of rows | python|pandas|dataframe|split | 0 | 40 | 1 | 72,329,817 | 72,329,817 | 2 | true | 2022-05-21T11:53:59.263Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Split a dataframe according to priorities and specific number of rows<p>I want to split a dataframe into 3 new dataframes according to a priority column. My ... |
72,329,882 | Create dynamic function in python?<p>I got NameError for calling test_gobject, but the funny thing is I never called this function name. I called <strong>test_gobjectpy()</strong><br />
Can you explain it to me why Python decide to call the wrong function name (see error output)</p>
<p>Maybe it has some problems becaus... | <p>In your loop you create functions, the first one created is effectively created like this:</p>
<pre><code>i = 'test_gobject.py'
tmp = 'test_gobjectpy'
exec(f"def {tmp}(): print({i})")
</code></pre>
<p>So, it's as if you ran:</p>
<pre><code>exec("def test_gobjectpy(): print(test_gobject.py)")
</c... | Create dynamic function in python? | python | -1 | 40 | 1 | 72,329,950 | 72,329,950 | 2 | true | 2022-05-21T13:11:03.013Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Create dynamic function in python?<p>I got NameError for calling test_gobject, but the funny thing is I never called this function name. I called <strong>tes... |
72,333,605 | Partial specialiszation of a template class with string template argument<pre><code>#include <iostream>
template<unsigned N>
struct FixedString
{
char buf[N + 1]{};
constexpr FixedString(const char (&s)[N])
{
for (unsigned i = 0; i != N; ++i)
buf[i] = s[i];
}
};
t... | <blockquote>
<p>What is the proper way to specialise template classes with string template arguments?</p>
</blockquote>
<p>The given code is well-formed(in C++20) but fails to compile for gcc 10.2 and lower. It however compiles fine from gcc 10.3 and higher. <a href="https://godbolt.org/z/8zTYvazhh" rel="nofollow noref... | Partial specialiszation of a template class with string template argument | c++|template-specialization | 1 | 40 | 1 | 72,334,439 | 72,334,439 | 2 | true | 2022-05-21T22:19:56.090Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Partial specialiszation of a template class with string template argument<pre><code>#include <iostream>
template<unsigned N>
struct FixedString ... |
72,334,933 | Merging time series dataframes in python<p>I am working with some financial tick data. Given two example dataframes like this:</p>
<p>left_df =</p>
<pre><code>Time Bid Price Ask Price
2022-01-02 00:00:01.323597 100 101
2022-01-02 00:00:01.828502 100 101
2022-01-02 00:... | <p>Try this</p>
<pre><code># convert to datetime
left_df['Time'] = pd.to_datetime(left_df['Time'])
right_df['Time'] = pd.to_datetime(right_df['Time'])
# insert time_right column
right_df.insert(1, 'Time_right', right_df['Time'])
# merge_asof
df = pd.merge_asof(left_df, right_df, on='Time', suffixes=('_left','_right'))
... | Merging time series dataframes in python | python|pandas|datetime|time-series|finance | 1 | 40 | 1 | 72,334,971 | 72,334,971 | 2 | true | 2022-05-22T05:05:17.333Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Merging time series dataframes in python<p>I am working with some financial tick data. Given two example dataframes like this:</p>
<p>left_df =</p>
<pre><cod... |
72,342,914 | DataFrame - time since last positive and last negative value<p>I have an input dataframe that looks like this:</p>
<pre><code>df = pd.DataFrame.from_dict({"t": [1,2,3,4,5], 'val': [100, 5, -4, -9, 1], })
</code></pre>
<p>I need to calculate the following 2 columns, one for the time since the last positive val... | <h2>Solution</h2>
<pre><code>m = df.val > 0
df['t_since_neg'] = df['t'] - df['t'].where(~m).ffill().shift()
df['t_since_pos'] = df['t'] - df['t'].where( m).ffill().shift()
</code></pre>
<hr />
<pre><code> t val t_since_neg t_since_pos
0 1 100 NaN NaN
1 2 5 NaN 1.0
2 3... | DataFrame - time since last positive and last negative value | python|pandas|dataframe | 1 | 40 | 1 | 72,343,001 | 72,343,001 | 2 | true | 2022-05-23T03:14:11.620Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
DataFrame - time since last positive and last negative value<p>I have an input dataframe that looks like this:</p>
<pre><code>df = pd.DataFrame.from_dict({&q... |
72,345,625 | How to get the onPressed response of a Button click form another screen?<p>I have created a Button in a separate file. Trying to pass the 'onPressed' as a function, and get the response of the click from a different screen via a constructor.</p>
<h1>Button Widget</h1>
<pre><code>class FullWidthButton extends StatelessW... | <p>Instead <code>final Function onButtonPressed;</code> try <code>final Function() onButtonPressed;</code></p>
<p>You pass already the function, but the <strong>ElevatedButton</strong> says that he want a Function(), not the "class" <strong>Function</strong></p> | How to get the onPressed response of a Button click form another screen? | flutter|dart | 1 | 40 | 2 | 72,345,680 | 72,345,680 | 2 | true | 2022-05-23T08:43:49.570Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to get the onPressed response of a Button click form another screen?<p>I have created a Button in a separate file. Trying to pass the 'onPressed' as a fu... |
72,354,951 | NGINX - Handle both ID or Username<p>I have 2 urls like this:</p>
<p><strong>1 - example.com/user/JohnFifty/</strong></p>
<p><strong>2 - example.com/user/45771/</strong></p>
<p>Both work, but only one or the other. I want to allow both, which is enabled in the PHP code.</p>
<p>I have tried</p>
<pre><code>if ($arg_id ~ ... | <p>This is exactly the case where a <a href="https://nginx.org/en/docs/http/ngx_http_map_module.html" rel="nofollow noreferrer"><code>map</code></a> block can be very helpful, being used among with the <a href="https://www.regular-expressions.info/named.html" rel="nofollow noreferrer">named capture groups</a>:</p>
<pre... | NGINX - Handle both ID or Username | nginx|url-rewriting|nginx-config | 0 | 40 | 1 | 72,355,061 | 72,355,061 | 2 | true | 2022-05-23T21:25:12.847Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
NGINX - Handle both ID or Username<p>I have 2 urls like this:</p>
<p><strong>1 - example.com/user/JohnFifty/</strong></p>
<p><strong>2 - example.com/user/457... |
72,355,844 | What is the best way to close a nonstandard anonymous pipe handle for child process on Windows?<p>On Linux, the pseudo-code looks roughly like this:</p>
<pre><code>setup_env();
pid = fork();
if (pid == 0) {
// we are the child
closeUnusedPipeEnd();
setup_child();
execve();
}
closeOtherUnusedPipeEnd();
</cod... | <p>One should use <code>kernel32.SetHandleInformation()</code> with <code>HANDLE_FLAG_INHERIT</code> to only inherit the pipe end used in the child process.</p> | What is the best way to close a nonstandard anonymous pipe handle for child process on Windows? | c|windows|pipe|anonymous | 2 | 40 | 1 | 72,355,845 | 72,355,845 | 2 | true | 2022-05-23T23:46:12.587Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is the best way to close a nonstandard anonymous pipe handle for child process on Windows?<p>On Linux, the pseudo-code looks roughly like this:</p>
<pre... |
72,368,922 | Pandas select rows from a DataFrame based on column values?<p>I have below <code>json</code> string loaded to <code>dataframe</code>. Now I want to filter the record based on <code>ossId</code>.</p>
<p>The condition I have is giving the error message. what is the correct way to filter by ossId?</p>
<pre><code>import pa... | <p>I think your issue is due to the json structure. You are actually loading into <code>df</code> a single row that is the whole list of field <code>component</code>.</p>
<p>You should instead pass to the dataframe the list of records. Something like:</p>
<pre><code>json_data = json.loads(data)
df = pd.DataFrame(json_d... | Pandas select rows from a DataFrame based on column values? | python|python-3.x|pandas|dataframe | 0 | 40 | 3 | 72,368,975 | 72,368,975 | 2 | true | 2022-05-24T20:09:07.090Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas select rows from a DataFrame based on column values?<p>I have below <code>json</code> string loaded to <code>dataframe</code>. Now I want to filter th... |
72,374,722 | Is this javascript code vulnerable to XSS<p>I have a simple <code>example.js</code> file that that is included in a html
<code><script src="example.js"></script></code></p>
<pre><code>'use strict';
function getURLParameter(name) {
return new URLSearchParams(window.location.search).get(name)
}
... | <p>No.</p>
<p>JavaScript does not execute strings returned from functions as if they were JS source code. They are <em>just</em> strings.</p> | Is this javascript code vulnerable to XSS | javascript|xss|poc | -1 | 40 | 1 | 72,374,753 | 72,374,753 | 2 | true | 2022-05-25T09:03:07.857Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is this javascript code vulnerable to XSS<p>I have a simple <code>example.js</code> file that that is included in a html
<code><script src="example.j... |
72,383,721 | In R, how do I code to analyse patients with follow up at any given time point?<p>I have patients with baseline pain scores and follow up of 6 months, 1 year and 2 years (each their own variable column). I have 26,000+ patients. There is missing data at those various time points. I can easily analyse pain score outcome... | <p>one approach:</p>
<pre><code>library(dplyr)
your_data_frame %>%
mutate(vas.outcome = coalesce(vas.6mth, vas.year, vas.two))
</code></pre> | In R, how do I code to analyse patients with follow up at any given time point? | r|dplyr|tidyverse | 0 | 40 | 3 | 72,383,996 | 72,383,996 | 2 | true | 2022-05-25T20:19:11.200Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
In R, how do I code to analyse patients with follow up at any given time point?<p>I have patients with baseline pain scores and follow up of 6 months, 1 year... |
72,259,703 | Hijacking the getattr and setattr functions after __init__ completes<p>I need to intercept setattr and getattr after <strong>init</strong> completion, i.e. if main class doesn't have required attribute, it would look for it in subclass Extra, or when setting attribute, if it's not in main class then setting went to sub... | <p>Direct operation attribute dictionary:</p>
<pre><code>class Test:
def __init__(self):
vars(self)['default_name'] = "Michael"
vars(self)['extra'] = Test.Extra()
def __setattr__(self, key, value):
if key not in vars(self):
setattr(self.extra, key, value)
... | Hijacking the getattr and setattr functions after __init__ completes | python|python-3.9 | 1 | 40 | 1 | 72,260,756 | 72,260,756 | 2 | true | 2022-05-16T13:04:33.510Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hijacking the getattr and setattr functions after __init__ completes<p>I need to intercept setattr and getattr after <strong>init</strong> completion, i.e. i... |
72,242,084 | Pandas Pivot is not producing desired output<p>I my data looks like below. I am trying to pivot the dataframe such that SCHEMA NAME AND TABLE NAME are in columns and Row Count, Table Type, date created and Date altered are in 1st column. I am referencing this <a href="https://stackoverflow.com/questions/47152691/how-ca... | <p>try this:</p>
<pre><code>data_df.set_index(['TABLE_SCHEMA', 'TABLE_NAME'], drop=True).T
</code></pre>
<p>data_df is the original dataframe that you provided</p> | Pandas Pivot is not producing desired output | python|pandas|pivot|pivot-table | 0 | 40 | 1 | 72,242,494 | 72,242,494 | 2 | true | 2022-05-14T16:26:20.050Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas Pivot is not producing desired output<p>I my data looks like below. I am trying to pivot the dataframe such that SCHEMA NAME AND TABLE NAME are in col... |
72,277,529 | Control on SQL join condition when there are more than one matching row<p>I have a join with more than one matching row. How can I have more control over the join? In particular, as shown in the example, when there is more than one matching row, I don't want to obtain any result and maintain my input.</p>
<p>In the pic... | <p>You might try this... I am not sure if it is exactly what you need.</p>
<p>If the coalesce with left-join would be null if no matching Insurance_Num, thus returning 0, <em>or</em>, there <em>is</em> a matching insurance_num, but the count is <em>other</em> than 1, it gets the <em>ELSE</em> condition of the CASE que... | Control on SQL join condition when there are more than one matching row | sql|hive | 0 | 40 | 1 | 72,278,318 | 72,278,318 | 2 | true | 2022-05-17T16:20:50.330Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Control on SQL join condition when there are more than one matching row<p>I have a join with more than one matching row. How can I have more control over the... |
72,338,300 | R plotting a graph with confidence intervals<p>I have a dataframe that looks like this -</p>
<pre><code>df = data.frame(recall=c(0.55,0.62,0.43,0.61,0.19,0.14,0,0.19,0.33,0.33,0,0.33),
type= c("Phone numbers","Phone numbers","Phone numbers","Phone numbers","E... | <p>Your code needs a couple of tweaks.</p>
<p>Firstly, <code>ggplot</code> only uses non-standard evaluation inside <code>aes</code>, so the use of <code>model</code> inside <code>scale_x_continuous</code> results in a "<code>model</code> not found" error.</p>
<p>Secondly, the x axis <em>isn't</em> continuous... | R plotting a graph with confidence intervals | r|ggplot2 | 0 | 40 | 1 | 72,338,461 | 72,338,461 | 2 | true | 2022-05-22T14:04:47.713Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R plotting a graph with confidence intervals<p>I have a dataframe that looks like this -</p>
<pre><code>df = data.frame(recall=c(0.55,0.62,0.43,0.61,0.19,0.1... |
72,307,789 | What is a reasonable size / order of magnitude for code splitting<p>We are working no a large React code base and want to split up the application into smaller chunks using react-loadable.</p>
<p>My team mates are currently trying to make each and every component lazy-loadable. I do not think this is the right approach... | <p>That's a interesting question and as tdelaney said, this is very opinion based and it depends on the kind of application your team is working on.</p>
<p><strong>Why not load everything in a lazy manner?</strong></p>
<p>I wondered why not to lazy load everything.</p>
<p>Imho, loading every component in a lazy way is ... | What is a reasonable size / order of magnitude for code splitting | reactjs|performance|react-loadable | 0 | 40 | 1 | 72,308,941 | 72,308,941 | 2 | true | 2022-05-19T16:07:37.580Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
What is a reasonable size / order of magnitude for code splitting<p>We are working no a large React code base and want to split up the application into small... |
72,274,533 | How to convert a list of intervals into the list of numbers comprised within these intervals?<p>I have a large file looking like this:</p>
<pre><code>esup_255_3 transdecoder 7655 8192
esup_6093_1 transdecoder 2732 2774
esup_25727_1 transdecoder 1 60
...
</code></pre>
<p... | <p>Something like this?</p>
<pre><code> perl -lne 'my ($line, $from, $to) = /^(.*\s(\d+)\s+(\d+)\s*)$/; print "$line\t$_" for $from..$to;'
</code></pre>
<p>When I run it on your snippet it prints out 641 lines:</p>
<pre><code>esup_255_3 transdecoder 7655 8192 7655
esup_255_3 tra... | How to convert a list of intervals into the list of numbers comprised within these intervals? | perl|intervals | -1 | 40 | 1 | 72,274,785 | 72,274,785 | 2 | true | 2022-05-17T13:01:05.187Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to convert a list of intervals into the list of numbers comprised within these intervals?<p>I have a large file looking like this:</p>
<pre><code>esup_25... |
72,394,447 | Why doesn't the MinMaxScaler change the sns.pairplot of the dataset?<p>I'm trying to create a pairplot of my dataset, where the variables are vastly different numbers (some are in the 0-1 range, some, like age and Monthly Income, can go way higher) and I want to scale those variables that go above 1 to 0-1 using the fo... | <p>The plots are expected to look the same, but not exactly - the tick labels should be different. The scaler does a linear transformation, and seaborn chooses the axis limits based on the range of values, so the arrangement of points in the scatter plots does not change.</p>
<p>Since I do not have your data, here is t... | Why doesn't the MinMaxScaler change the sns.pairplot of the dataset? | python|scale|pairplot | 2 | 40 | 1 | 72,398,123 | 72,398,123 | 2 | true | 2022-05-26T15:40:23.840Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why doesn't the MinMaxScaler change the sns.pairplot of the dataset?<p>I'm trying to create a pairplot of my dataset, where the variables are vastly differen... |
72,396,566 | Print strings from a sublist with no quotes and in new lines (no commas)<p>Context: I'm trying to print a sub list of genes without commas, in new lines and without quotes.</p>
<p>Currently, I have this: (maybe the fact that the output is with single quotes and then double quotes is the issue)</p>
<pre><code>gene_list ... | <p>The strings in your list has quotes. You can use <code>strip.('"')</code> to get rid of the surrounding quotes in your string:</p>
<pre class="lang-py prettyprint-override"><code>gene_list = [['"geneName"','"STEAP2"', '"ADGRF4"', '"SNED1"', '"PF4V1"', '"CEA... | Print strings from a sublist with no quotes and in new lines (no commas) | python|string | -2 | 40 | 1 | 72,396,637 | 72,396,637 | 2 | true | 2022-05-26T18:41:29.643Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Print strings from a sublist with no quotes and in new lines (no commas)<p>Context: I'm trying to print a sub list of genes without commas, in new lines and ... |
72,341,602 | No module named 'sportsreference'<p>I pip installed the <code>sportsreference</code> package in my command prompt and it shows successful. Yet when I try to call it in my Jupyter Notebook it says no module named <code>sportsreference</code>.</p>
<p>Any help on what I'm doing wrong?</p>
<p><img src="https://i.stack.imgu... | <p>The interpreter that your Jupyter uses to run the cells is not the one you installed that package into. Remember you can have not only different versions of Python interpreter, but also different virtual environments associated with each Python interpreter in your machine.</p>
<p>So either install the package in the... | No module named 'sportsreference' | python|pip | 1 | 40 | 1 | 72,341,633 | 72,341,633 | 2 | true | 2022-05-22T22:07:19.430Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
No module named 'sportsreference'<p>I pip installed the <code>sportsreference</code> package in my command prompt and it shows successful. Yet when I try to ... |
72,319,657 | Why is this python function not reading my json File string properly?<p>So I have a unique player ID string that is stored in a JSON file after it detects on start-up that the player is new to the game.</p>
<pre><code>def checkIfPlayerIsNew():
if os.path.exists("myJson.json"):
print('file exists'... | <p>You can't <code>read()</code> a file twice without seeking back to the start. The right thing to do here is to read the file into a variable:</p>
<pre class="lang-py prettyprint-override"><code>if os.path.exists("myJson.json"):
print('file exists')
# Read file into a variable and use it twice
... | Why is this python function not reading my json File string properly? | python|json|file | -1 | 40 | 1 | 72,319,722 | 72,319,722 | 2 | true | 2022-05-20T13:22:01.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why is this python function not reading my json File string properly?<p>So I have a unique player ID string that is stored in a JSON file after it detects on... |
72,384,709 | Why I can't get the new view added in the ASP.NET Core application?<p>I'm newer to ASP.NET Core applications and I'm trying to add a view, so I've added a function <code>MYName()</code> in <code>HomeController.cs</code> and I have created a view by clicking on <code>MYName()</code> function and choosing "Details&q... | <p>The header can be updated via the shared _Layout.cshtml file.
Change this code to reflect:</p>
<pre><code> <ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="&qu... | Why I can't get the new view added in the ASP.NET Core application? | c#|html|asp.net-core | 0 | 40 | 1 | 72,384,914 | 72,384,914 | 2 | true | 2022-05-25T22:18:25.627Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Why I can't get the new view added in the ASP.NET Core application?<p>I'm newer to ASP.NET Core applications and I'm trying to add a view, so I've added a fu... |
72,299,401 | SQL statement before 3 days<p>I am using this query to get dates from MYSQL DB to show before current date. I want to show records using the current system date and before 3 days</p>
<pre><code>SELECT gsu.id, gsuo.user_id, gsob.imei, gsob.vin, gsob.dt_tracker
FROM gs_users gsu
INNER JOIN gs_user_objects gsuo
ON gsu.... | <p>For MySQL you need to use <code>DATE_ADD()</code> <a href="https://www.w3schools.com/sql/func_mysql_date_add.asp" rel="nofollow noreferrer">function</a> with interval parameter</p>
<pre><code>date_add(curdate(), interval -3 day) -- today minus 3 days
</code></pre>
<p>Here's <a href="https://dbfiddle.uk/?rdbms=mysql_... | SQL statement before 3 days | mysql|sql | 0 | 40 | 1 | 72,299,483 | 72,299,483 | 3 | true | 2022-05-19T06:07:28.070Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
SQL statement before 3 days<p>I am using this query to get dates from MYSQL DB to show before current date. I want to show records using the current system d... |
72,301,494 | Unable to display the data into UICollection view<p>I am trying to display the data into UI collection view .I am following the MVVM Architecture pattern. I am following programatic approach . I put the break point , I can see onto console , The data is decoded from URL but problem is it not displaying the into view c... | <p>The problem is you are not setting the delegate for viewModel
add the following line in <code>viewDidLoad</code> before calling <code>viewModel.fecthPhotoRecord()</code></p>
<pre><code>viewModel.delegate = self
</code></pre> | Unable to display the data into UICollection view | swift|mvvm|uicollectionview|delegates|uicollectionviewcell | 0 | 40 | 2 | 72,302,024 | 72,302,024 | 3 | true | 2022-05-19T08:54:03.350Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unable to display the data into UICollection view<p>I am trying to display the data into UI collection view .I am following the MVVM Architecture pattern. I ... |
72,328,687 | Python - inner workings of __iter__<p>I have got the following class:</p>
<pre><code>class RandomNumbers:
def __init__(self, length, *, range_min=0, range_max=10):
self.length = length
self.range_min = range_min
self.range_max = range_max
self.i = 0
def __len__(self):
re... | <p>Your for loop could be rewritten as this somewhat equivalent code</p>
<pre><code>it = iter(RandomNumbers(10))
while True:
try:
number = next(it)
except StopIteration:
break
else:
# Body of the for loop
print(number)
</code></pre>
<p>Your class needs to implement the <code>... | Python - inner workings of __iter__ | python|iterator | 1 | 40 | 1 | 72,328,731 | 72,328,731 | 3 | true | 2022-05-21T10:26:41.603Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Python - inner workings of __iter__<p>I have got the following class:</p>
<pre><code>class RandomNumbers:
def __init__(self, length, *, range_min=0, rang... |
72,334,864 | HTML not rendering my basic three.js code<p>im a bit of a noob when it comes to three.js and html but ive created other js files and they would import into the html page just fine but im confused why my basic box copy pasta code isnt showing up on the page. it works fine when scripting it all in html but not when impo... | <p>When using the latest versions of <code>three.js</code>(e.g. <code>r140</code>), then it's important to define an import map in your HTML. Otherwise the import <code>import * as THREE from 'three';</code> does not work. A import map is required so the bare module specifier <code>three</code> can be resolved in brows... | HTML not rendering my basic three.js code | javascript|html|three.js | 0 | 40 | 1 | 72,335,662 | 72,335,662 | 3 | true | 2022-05-22T04:45:48.097Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
HTML not rendering my basic three.js code<p>im a bit of a noob when it comes to three.js and html but ive created other js files and they would import into ... |
72,344,110 | Using query in google sheet to call certain rows<p><a href="https://i.stack.imgur.com/1YbB5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1YbB5.png" alt="" /></a></p>
<p>Hi everyone,</p>
<p>I want to get all the rows where <code>A=1</code>, <code>A=2</code>. The query is very simple but I'm not sur... | <p>A can't be both: 2 and 1. Instead try</p>
<pre><code>=query(A3:C, "Where A = 2 or A = 1", 0)
</code></pre> | Using query in google sheet to call certain rows | google-sheets|google-sheets-formula|formula | 0 | 40 | 3 | 72,344,272 | 72,344,272 | 3 | true | 2022-05-23T06:31:35.920Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Using query in google sheet to call certain rows<p><a href="https://i.stack.imgur.com/1YbB5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.co... |
72,348,150 | How to display data from json into HTML using js table<p>How can I insert this code into js table</p>
<pre><code>if (data.players.length) {data.players.forEach((ply)=>{
let plycont = document.createElement('div')
let plyspan = generate_colored_span(ply.n... | <p>You can create create table and</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const addRow = (el, data) => {
if (data.length) {
data.forEach((ply) => {
c... | How to display data from json into HTML using js table | javascript|json | -1 | 40 | 1 | 72,348,296 | 72,348,296 | 3 | true | 2022-05-23T11:56:51.133Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to display data from json into HTML using js table<p>How can I insert this code into js table</p>
<pre><code>if (data.players.length) {data.players.forEa... |
72,369,075 | Join rows with minimum and maximum value on a specific column<p>I have a table that looks like this:</p>
<pre><code>COL ID_1 FOR A4
COL ID_2 FOR A4
COL ID_3 FOR A4
SELECT 'A1' ID_1, 'B1' ID_2, 10 NUM, 'X' ID_3 FROM DUAL UNION ALL
SELECT 'A1' ID_1, 'B2' ID_2, 20 NUM, 'Y' ID_3 FROM DUAL UNION ALL
SELECT 'A1' ID_1, 'B3' ... | <p>You can do it without any self-joins using aggregation functions with <code>KEEP (DENSE_RANK [FIRST|LAST] ORDER BY ...)</code>:</p>
<pre class="lang-sql prettyprint-override"><code>SELECT id_1,
MIN(id_2) KEEP (DENSE_RANK FIRST ORDER BY num) AS min_id_2,
MIN(num) AS min_num,
MIN(id_3) KEEP (DENSE... | Join rows with minimum and maximum value on a specific column | sql|oracle | 0 | 40 | 2 | 72,369,165 | 72,369,165 | 3 | true | 2022-05-24T20:25:20.090Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Join rows with minimum and maximum value on a specific column<p>I have a table that looks like this:</p>
<pre><code>COL ID_1 FOR A4
COL ID_2 FOR A4
COL ID_3 ... |
72,400,345 | MySQL query with multiple joins but only join one table at a time<p>Now I have 3 tables, <code>user</code>, <code>question</code> and <code>answer</code>. And want to query the user's question and answer in one query. I have tried left join but the result was not what I expected. Here is the SQL:</p>
<pre><code>SELECT ... | <p>You could just union the result of those 2 tables</p>
<pre><code>SELECT q.user_id as id, q.id AS question, NULL AS answer FROM question q WHERE q.user_id = 1
UNION ALL
SELECT a.user_id, NULL, a.id FROM answer a WHERE a.user_id = 1
</code></pre> | MySQL query with multiple joins but only join one table at a time | mysql | 0 | 40 | 2 | 72,400,490 | 72,400,490 | 3 | true | 2022-05-27T04:02:26.850Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
MySQL query with multiple joins but only join one table at a time<p>Now I have 3 tables, <code>user</code>, <code>question</code> and <code>answer</code>. An... |
72,275,721 | ggplot within function does not fully work<p>I am trying to create Bland-Altman plots between 2 sets of percentages with a custom function that uses ggplot within it to generate the plot.</p>
<pre><code>Perc1 <- sample(1:100, 100)
Perc2 <- sample(1:100, 100)
d <- data.frame(Perc1, Perc2)
bland <- function(... | <p>Try this:</p>
<p>(Note also, the <code>p <-</code> and <code>plot(p)</code> are not needed as the function anyway returns the last object.)</p>
<pre class="lang-r prettyprint-override"><code>library(tidyverse)
Perc1 <- sample(1:100, 100)
Perc2 <- sample(1:100, 100)
bland <- function(x, y){
df <- d... | ggplot within function does not fully work | r|function|ggplot2|statistics | 0 | 40 | 1 | 72,275,852 | 72,275,852 | 3 | true | 2022-05-17T14:20:03.053Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
ggplot within function does not fully work<p>I am trying to create Bland-Altman plots between 2 sets of percentages with a custom function that uses ggplot w... |
72,349,540 | passing column name without quotation marks to user defined function to work with NAs in R<p>my function is going to take data and column name from user.<br>
column name must be passed only like : <code>column</code> or <code>my column</code> (ie, no "" s only backticks if column name is multi words)<br></p>
... | <p>I think you need to use <code>replace_na()</code> within <code>mutate()</code>. If you use the same strategy as for converting your columns to character, this seems to solve the problem:</p>
<pre class="lang-r prettyprint-override"><code>myfun <- function(data, column){
library(tidyverse)
data <- as_tibble... | passing column name without quotation marks to user defined function to work with NAs in R | r|function|dplyr|tidyverse | 2 | 40 | 1 | 72,349,625 | 72,349,625 | 3 | true | 2022-05-23T13:37:39.747Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
passing column name without quotation marks to user defined function to work with NAs in R<p>my function is going to take data and column name from user.<br>... |
72,389,316 | Front and rear pointers of circular queue exceed the size of array<p>front and rear pointers of circular queue are exceeding the size of array which can be seen in the print statement the input given for size was 3 where pointers go till the value 4 and 6.It would be helpful if someone could point out where I am going ... | <p>Compiling the code in the question with warnings enabled reveals that <code>q</code> is used uninitialized in line 113, <code>q->f = -1;</code>. In the prior line, <code>struct queue *q;</code>, q is defined but not given any value. Because of this, the behavior of the program is not defined by the C standard, an... | Front and rear pointers of circular queue exceed the size of array | c|struct|circular-queue | 0 | 40 | 1 | 72,391,493 | 72,391,493 | 3 | true | 2022-05-26T09:01:53.220Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Front and rear pointers of circular queue exceed the size of array<p>front and rear pointers of circular queue are exceeding the size of array which can be s... |
72,334,307 | Is it possible to use any command to create a new repo on github in command line?<p>I tried to searched the google but didn't get any clue about this.
If i can use git command to create a new repo on github, so i dont have to open github website and click to create a repo,it will be easier to use.</p> | <p>Download <a href="https://github.com/cli/cli#installation" rel="nofollow noreferrer">Github CLI</a></p>
<p>And use these commands</p>
<pre><code>gh repo create [set_name_for_repo]
</code></pre> | Is it possible to use any command to create a new repo on github in command line? | git|github|github-cli | -1 | 40 | 1 | 72,334,369 | 72,334,369 | 4 | true | 2022-05-22T01:57:58.687Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it possible to use any command to create a new repo on github in command line?<p>I tried to searched the google but didn't get any clue about this.
If i ... |
72,383,891 | Segmentation Fault 11 when using a compare function in qsort()<p>I have an array of <code>struct dir_item</code> and I want to sort it using <code>qsort</code>.
Using the following code I get a <code>Segmentation Fault 11</code>.</p>
<p>I would like to know:</p>
<ul>
<li>How to fix this issue?</li>
<li>Why I have this ... | <p>You've got too many <code>*</code>, simply cast <code>d1</code> and <code>d2</code> to <code>struct dir_item*</code> and dereference:</p>
<pre class="lang-c prettyprint-override"><code>int compare(const void *d1, const void *d2)
{
return (strcmp(((struct dir_item *)d1)->name,
((struct dir_i... | Segmentation Fault 11 when using a compare function in qsort() | c | 0 | 40 | 1 | 72,384,037 | 72,384,037 | 4 | true | 2022-05-25T20:37:59.673Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Segmentation Fault 11 when using a compare function in qsort()<p>I have an array of <code>struct dir_item</code> and I want to sort it using <code>qsort</cod... |
72,277,050 | how to retrieve and store a list of lists extracted from a list by partial string match?<p>I'm trying to pull out all the lines from a text file (which is a list of lines) that occur between list items containing the string 'Chapter '.</p>
<p>My data, <code>content_lines</code>, looks like this:</p>
<pre><code>['Chapte... | <p>Try iterating and creating your output:</p>
<pre><code>output = list()
for line in content_lines:
if line.startswith("Chapter"):
output.append([])
else:
output[-1].append(line)
>>> output
[['Sir Walter Elliot.....', 'Another paragraph of text.', 'And another....'],
['Para... | how to retrieve and store a list of lists extracted from a list by partial string match? | python | 1 | 40 | 2 | 72,277,141 | 72,277,141 | 4 | true | 2022-05-17T15:45:35.690Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to retrieve and store a list of lists extracted from a list by partial string match?<p>I'm trying to pull out all the lines from a text file (which is a ... |
72,336,759 | csv data ending with comma at end | python |<p>I have written a code but the issue with the code is</p>
<p>I am not able to identify how to get rid of last ending command comma from my obtained expected output</p>
<p><strong>Code:</strong></p>
<pre><code>import xml.etree.ElementTree as ET
xml_data='''
<job_details&... | <p>You can simplify your code with this:</p>
<p>You can iterate directly through <code>get_root_Elements</code>.
Then instead of using <code>print()</code> you take all elements of each item and <code>join</code> it with the right seperator.
Also no need to break out of the for loop, it will stop itself.
I appended all... | csv data ending with comma at end | python | | python|xml|csv | 2 | 40 | 2 | 72,336,849 | 72,336,849 | 4 | true | 2022-05-22T10:33:37.087Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
csv data ending with comma at end | python |<p>I have written a code but the issue with the code is</p>
<p>I am not able to identify how to get rid of last e... |
72,350,939 | R: Turn Months into Quarters<p>I have a dataset that looks like this:</p>
<pre><code>> ex
# A tibble: 10 × 2
tenor delivery_window
<chr> <chr>
1 month Nov 22
2 quarter Jan 22
3 year Cal 24
4 year Cal 22
5 month Feb 22
6 quarter... | <p>We can convert to <code>yearqtr</code> with <code>as.yearqtr</code> (from <code>zoo</code>), and use <code>case_when</code> to replace the elements in 'delivery_window' with the converted value</p>
<pre><code>library(dplyr)
library(stringr)
library(zoo)
ex <- ex %>%
mutate(new_tenor = case_when(tenor =... | R: Turn Months into Quarters | r|date|character | 2 | 40 | 1 | 72,350,971 | 72,350,971 | 5 | true | 2022-05-23T15:15:55.873Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
R: Turn Months into Quarters<p>I have a dataset that looks like this:</p>
<pre><code>> ex
# A tibble: 10 × 2
tenor delivery_window
<chr> <... |
72,304,426 | Kotlin cannot make out that I've already checked whether the item is in the collection<pre><code>val map = mapOf(
'a' to 1,
'b' to 2,
'c' to 3
)
val c = 'a'
if (c in map) {
println(map[c] + 1)
}
</code></pre>
<p>In the simple code stub, Kotlin compiler does not allow me to perform the operation in <cod... | <p>As far as Kotlin is concerned, there is no relation between <code>c in map</code> being true and <code>map[c]</code> not being null. Note that <code>c in map</code> is just sugar for <code>map.contains(c)</code>, and <code>map[c]</code> is just sugar for <code>map.get(c)</code>. <code>get</code> and <code>contains</... | Kotlin cannot make out that I've already checked whether the item is in the collection | kotlin|null-check | 0 | 40 | 1 | 72,304,635 | 72,304,635 | 7 | true | 2022-05-19T12:19:55.453Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Kotlin cannot make out that I've already checked whether the item is in the collection<pre><code>val map = mapOf(
'a' to 1,
'b' to 2,
'c' to 3
)
... |
72,241,737 | How to call more than one function in javascript onclick event?<p><Button onClick={(e)=>setId(_id); handleDelete()}>Delete</p>
<p>I tried this way, but it gives error.</p> | <p>I think you must wrap the content of the arrow function in { }, like this</p>
<pre><code><Button onClick={(e) => {setId(_id); handleDelete()} }>Delete</Button>
</code></pre>
<p>and don't forget the closing tag for the Button component</p>
<p>I hope that solves your problem.</p> | How to call more than one function in javascript onclick event? | javascript|reactjs|onclick | -3 | 40 | 1 | 72,241,776 | 72,241,776 | -1 | true | 2022-05-14T15:39:50.757Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to call more than one function in javascript onclick event?<p><Button onClick={(e)=>setId(_id); handleDelete()}>Delete</p>
<p>I tried this way, ... |
72,925,006 | JSON Web Tokens Node JS Server ERROR SyntaxError: Unexpected token } in JSON at position 24<p>Me and others are experiencing <strong>this error</strong>: <code>SyntaxError: Unexpected token } in JSON at position 24 at JSON.parse (<anonymous>)</code> while following this tutorial on <strong>JSON Web Tokens</strong... | <p>It appears the issue lies in the request you're making. You have a trailing comma in the JSON that you are sending in your request.</p>
<p>If you are new to using JSON & JavaScript, just try to remember that JavaScript objects !== JSON.</p>
<p>In JS Objects, you can have trailing commas. However, in JSON it will... | JSON Web Tokens Node JS Server ERROR SyntaxError: Unexpected token } in JSON at position 24 | javascript|node.js|json|express|jwt | -1 | 40 | 1 | 72,925,059 | 72,925,059 | 1 | true | 2022-07-09T22:27:18.677Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
JSON Web Tokens Node JS Server ERROR SyntaxError: Unexpected token } in JSON at position 24<p>Me and others are experiencing <strong>this error</strong>: <co... |
73,029,566 | Use Openfiledialog to browser folder<p>Can I Use Openfiledialog to browser folder? Because I really hate using FolderBrowserDialog().</p> | <p>I had the same issue in one of my projects and found a solution. You can use it if you get the Microsoft.WindowsAPICodePack-Shell nuget package and use the Microsoft.WindowsAPICodePack.Dialogs namespace.
Use it as such:</p>
<pre class="lang-cs prettyprint-override"><code>CommonOpenFileDialog dialog = new CommonOpenF... | Use Openfiledialog to browser folder | c#|openfiledialog | -1 | 40 | 1 | 73,029,667 | 73,029,667 | 1 | true | 2022-07-18T23:18:58.320Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Use Openfiledialog to browser folder<p>Can I Use Openfiledialog to browser folder? Because I really hate using FolderBrowserDialog().</p> |
73,026,322 | Is there a size limitation to chan pipe on commande line?<p>This is probably a very stupid question but why does this freeze on the CLI if the size of the file is over 65,536? If 64kb is the limit to a pipe in Linux, is it possible to send larger files through this set up to process them?</p>
<p>Does it have anything t... | <p>When writing to a non-blocking channel, if you try to write more data than it can currently accept, tcl buffers the rest and tries to write it later. The maximum internal buffer size is 1,000,000 bytes. So on large input files, it's better to do the copying incrementally, say using the event loop (Especially when yo... | Is there a size limitation to chan pipe on commande line? | pipe|tcl | 0 | 40 | 1 | 73,027,690 | 73,027,690 | 1 | true | 2022-07-18T17:30:50.953Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is there a size limitation to chan pipe on commande line?<p>This is probably a very stupid question but why does this freeze on the CLI if the size of the fi... |
73,005,260 | Add item from array to another array where is same id<p>Any way how to add current_value from <strong>array2</strong> to <strong>array1</strong> where is <em>same filter_id</em> ?</p>
<p><strong>array1</strong></p>
<pre><code>const [productsFiltersSlider, setProductsFiltersSlider] = React.useState(undefined);
0: {id: ... | <p>Try like below:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const productsFiltersSlider = [{ id: '1', product_id: '28', filter_id: '26', type: 'slider', value: '60' }, {... | Add item from array to another array where is same id | reactjs|arrays|json | 1 | 40 | 1 | 73,005,321 | 73,005,321 | 1 | true | 2022-07-16T15:01:40.970Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Add item from array to another array where is same id<p>Any way how to add current_value from <strong>array2</strong> to <strong>array1</strong> where is <em... |
73,026,616 | merge two picturebox and save<p>I am developing a c# windows form application.. I want to merge two picturebox and save it to custom file location.. I used following code to do it. But it only save 2nd picturebox image. Could anybody tell me how to merge this two picturebox and save it..</p>
<pre><code> {
... | <p>Maybe need some adjustements (not tested) but I think it's useful:</p>
<pre><code>using (var src1 = new Bitmap(@"c:\...\image1.png"))
using (var src2 = new Bitmap(@"c:\...\image2.png"))
using (var bmp = new Bitmap(src1.Width + src2.Width, src1.Height, PixelFormat.Format32bppPArgb))
using (var g =... | merge two picturebox and save | c#|windows-forms-designer | 0 | 40 | 1 | 73,026,815 | 73,026,815 | 1 | true | 2022-07-18T17:56:23.340Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
merge two picturebox and save<p>I am developing a c# windows form application.. I want to merge two picturebox and save it to custom file location.. I used f... |
72,904,220 | Dealing with memory issue (SIGKILL) when manipulating large arrays<p>I wrote this function to perform a rolling sum on numpy arrays, inspired by <a href="https://stackoverflow.com/questions/14313510/how-to-calculate-rolling-moving-average-using-python-numpy-scipy/14314054#14314054">this post</a></p>
<pre><code>def np_r... | <p>For people who might be interested, I finally added a decorator that checks if numpy arguments are greater than a given size. If so, it turns them into dask arrays.</p>
<p>In order to keep the main function closest to the original, I also added an argument that indicates which library should be used: numpy or dask.a... | Dealing with memory issue (SIGKILL) when manipulating large arrays | python|numpy|memory | 1 | 40 | 1 | 72,971,541 | 72,971,541 | 1 | true | 2022-07-07T21:06:47Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Dealing with memory issue (SIGKILL) when manipulating large arrays<p>I wrote this function to perform a rolling sum on numpy arrays, inspired by <a href="htt... |
72,862,281 | How to plot the distribution between 2 variables with Plotly Express (Python)?<p>I have a dataframe, which looks like this and contains around 20.000 rows.</p>
<pre><code>print(df)
>>>>
CUSTOMER_INCOME MARITAL_STATUS
50000 Relationship
65000 Single
17000 Single
12000... | <p>I think you want to use the color option in using px.histogram. I believe this solves your problem:</p>
<pre><code>fig = px.histogram(df, x="CUSTOMER_INCOME",color="MARITAL_STATUS",barmode="overlay")
</code></pre>
<p>Do note that this won't get you distributions (distributions sum to 1)... | How to plot the distribution between 2 variables with Plotly Express (Python)? | python|plot|plotly | 0 | 40 | 1 | 72,862,384 | 72,862,384 | 1 | true | 2022-07-04T21:45:17.457Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to plot the distribution between 2 variables with Plotly Express (Python)?<p>I have a dataframe, which looks like this and contains around 20.000 rows.</... |
72,916,273 | Laravel mySQL view return by specific ID<p>So I am quite new to Laravel, and I have a situation, where I am trying to gather data from a pivot table (contains 2 foreign keys only) in order to retrieve data from other tables.</p>
<p>Before everything, I'd like to note, that word "campaign" is the same as "... | <p>First of all, yout need to start to use Laravel Eloquent Models.</p>
<p>But doing by your way (the hardest):</p>
<p>You need to create a route in web or api, something like that:</p>
<pre><code>Route::get('/box/{id}', [BoxController::class, 'view']);
</code></pre>
<p>Then you need to put this function on your contro... | Laravel mySQL view return by specific ID | php|mysql|laravel|laravel-8 | 0 | 40 | 1 | 72,916,563 | 72,916,563 | 1 | true | 2022-07-08T19:42:14.127Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Laravel mySQL view return by specific ID<p>So I am quite new to Laravel, and I have a situation, where I am trying to gather data from a pivot table (contain... |
72,968,488 | Query to show dates that are missed in table<p>This is using SQL Server 2019</p>
<p>Difficult to explain; I have two tables:</p>
<p>DATES:</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>DATE</th>
</tr>
</thead>
<tbody>
<tr>
<td>01/01/2022</td>
</tr>
<tr>
<td>02/01/2022</td>
</tr>
</tbody>
... | <p>We can build the list of desired values with a <strong>cross join</strong>, and then use an <strong>exclusion join</strong> to find what is missing from that set:</p>
<pre><code>SELECT d.[Date], IDs.INSURANCE_COVER_ID
FROM [dates] d
CROSS JOIN (SELECT DISTINCT INSURANCE_COVER_ID FROM INSURANCE_COVER) IDs
LEFT JOIN I... | Query to show dates that are missed in table | sql|sql-server | 0 | 40 | 1 | 72,968,594 | 72,968,594 | 1 | true | 2022-07-13T15:03:35.100Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Query to show dates that are missed in table<p>This is using SQL Server 2019</p>
<p>Difficult to explain; I have two tables:</p>
<p>DATES:</p>
<div class="s-... |
72,916,831 | Apps Script "if false return true" argument notation - for loop<p>I am currently trying to write a for loop that will loop until it comes to a blank cell at which point I want the loop to end. That part is easy. Today I stumbled upon something that made it even easier, potentially. The reason I am here is because I dec... | <ul>
<li><p><code>!</code> is <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_NOT" rel="nofollow noreferrer">logical NOT</a> operator.</p>
</li>
<li><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for" rel="nofollow noreferrer">... | Apps Script "if false return true" argument notation - for loop | for-loop|google-apps-script|logic | 1 | 40 | 2 | 72,917,108 | 72,917,108 | 1 | true | 2022-07-08T20:45:38.563Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Apps Script "if false return true" argument notation - for loop<p>I am currently trying to write a for loop that will loop until it comes to a blank cell at ... |
73,020,634 | how to paste content of clipboard?<p>I want to copy/paste some content from one div to another<br />
In the example below clicking on <code>paste</code> button expected result in <code>target</code> div is - <code><p>lorem ipsum</p></code><br />
but simply - nothing happens</p>
<p><div class="snippet" data-... | <p><code>readText()</code> (just as <code>writeText</code>) <a href="https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/readText" rel="nofollow noreferrer">returns a Promise</a>, you need to await for it. So in your case it will be something like this:</p>
<pre class="lang-js prettyprint-override"><code>
naviga... | how to paste content of clipboard? | javascript|jquery|copy|paste | 1 | 40 | 1 | 73,020,731 | 73,020,731 | 1 | true | 2022-07-18T10:12:38.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
how to paste content of clipboard?<p>I want to copy/paste some content from one div to another<br />
In the example below clicking on <code>paste</code> butt... |
72,890,676 | Is it necessary to push your commit files from a new branch?<p>I created a new branch to work on so I can improve my app and therefore made a new branch. As you all know, you need to commit your changes to your new branch so it won't affect your main branch.</p>
<p>My question is do you have to push your commits from y... | <p>You don't <em>have</em> to do <em>anything</em>.</p>
<p>You are working with a Git repository on your computer (called the "local"). The notion "push" implies that you have some <em>other</em> Git repository in some <em>other</em> location (called the "remote") that you want to keep syn... | Is it necessary to push your commit files from a new branch? | git|github | -1 | 40 | 1 | 72,890,862 | 72,890,862 | 1 | true | 2022-07-06T22:58:26.460Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Is it necessary to push your commit files from a new branch?<p>I created a new branch to work on so I can improve my app and therefore made a new branch. As ... |
72,963,335 | Unexpected behavior of XCTWaiter.wait<p>For testing purposes, I have the following test function:</p>
<pre><code>func test_wait() {
var string: String?
DispatchQueue.main.async {
string = "set"
print("string set")
}
let notNilPredicate = NSPredicate(format: "self... | <p>It's the predicate (and the semantics of capture). You think you are handing a <em>reference</em> to <code>string</code> into your predicate evaluation, but you aren't; you are just passing <code>nil</code>, and <code>nil</code> is not going to magically be not-<code>nil</code> any time soon. To confuse yourself les... | Unexpected behavior of XCTWaiter.wait | xcode|unit-testing|xctest|xctestexpectation|xctwaiter | 0 | 40 | 1 | 72,965,346 | 72,965,346 | 1 | true | 2022-07-13T08:45:09.863Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Unexpected behavior of XCTWaiter.wait<p>For testing purposes, I have the following test function:</p>
<pre><code>func test_wait() {
var string: String?
... |
72,940,024 | Typescript prepended union template literal types<p>I there a way to create literal string types from other string types with a prefix? Beter knowing there isn't than dwendle on this idea.</p>
<pre class="lang-js prettyprint-override"><code>type UserField = "id" | "name";
type PostField = "id&q... | <p>You can use the feature template literal types using string interpolation allowing union types to combine.</p>
<pre><code>type UserField = "id" | "name";
type PostField = "id" | "message" | `author.${UserField}`;
</code></pre> | Typescript prepended union template literal types | typescript | 1 | 40 | 1 | 72,940,125 | 72,940,125 | 1 | true | 2022-07-11T14:18:49.707Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Typescript prepended union template literal types<p>I there a way to create literal string types from other string types with a prefix? Beter knowing there i... |
72,896,537 | c++ loop through a class private unique_ptr array from non-friend external utility function without using c-style for loop<p>I've got a class with:</p>
<pre><code>class vector_class {
private:
std::unique_ptr<int[]> my_vector;
int size_;
public:
auto at(int) const -> int; // returns value at subsc... | <p>Iterators were designed to emulate much of the behavior of pointers, so much that all pointers can be used as iterators.</p>
<p>So if you have an array, and the number of elements in the array, you can use a pointer to the first element of the array as the <code>begin</code> iterator. And a pointer to one element be... | c++ loop through a class private unique_ptr array from non-friend external utility function without using c-style for loop | c++ | 1 | 40 | 1 | 72,896,677 | 72,896,677 | 1 | true | 2022-07-07T10:53:06.883Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
c++ loop through a class private unique_ptr array from non-friend external utility function without using c-style for loop<p>I've got a class with:</p>
<pre>... |
72,942,728 | Group GPS locations based on the first and last two points of the event<p>Everyone.</p>
<p>I'm trying to identify attempted road crossing events using GPS data. My initial plan was to buffer the road by two distances (10km, 500m) on the west and east side of a road, intersect the GPS data with the buffers, and identify... | <p>If you want the first and last events with in a group, you could use <code>group_by()</code> and <code>first()</code> and <code>last()</code> in the dplyr package.</p>
<p>But what if you wanted to summarize all movements by each individual within year? You could define each case with logic, e.g., west_10km to west_5... | Group GPS locations based on the first and last two points of the event | r|gps|spatial | 1 | 40 | 1 | 72,944,584 | 72,944,584 | 1 | true | 2022-07-11T17:52:56.877Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Group GPS locations based on the first and last two points of the event<p>Everyone.</p>
<p>I'm trying to identify attempted road crossing events using GPS da... |
72,893,966 | Count percentage of observations that switch value<p>I have a dataset that has two columns. One column indicates the group and each group has only two rows. The second column represents the category. Now I would like to count the percentage of each group not having the same category. So in row 1 and 2, the Category is ... | <p>A <code>base</code> solution with <code>tapply()</code>:</p>
<pre class="lang-r prettyprint-override"><code>mean(with(df, tapply(Category, Group, \(x) length(unique(x)))) > 1)
# [1] 0.6666667
</code></pre>
<p>With <code>dplyr</code>, you could use <code>n_distinct()</code> to count the number of unique values.</... | Count percentage of observations that switch value | r|dplyr|count|percentage | 1 | 40 | 3 | 72,894,112 | 72,894,112 | 1 | true | 2022-07-07T07:39:21.130Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Count percentage of observations that switch value<p>I have a dataset that has two columns. One column indicates the group and each group has only two rows. ... |
72,829,369 | How to use sub-commands along with optional positional arguments in argparse<p>Below scripts prints an output as well as opens a webpage based on command line arguments.</p>
<pre><code>#main.py
import os, numpy
import argparse
import webbrowser
new=2
def main():
parser = argparse.ArgumentParser()
parser.add... | <p>You're looking for the <code>action='store_true'</code> property on the argument specification.
<a href="https://docs.python.org/3/library/argparse.html#action" rel="nofollow noreferrer">https://docs.python.org/3/library/argparse.html#action</a></p>
<pre class="lang-py prettyprint-override"><code>parser.add_argument... | How to use sub-commands along with optional positional arguments in argparse | python|argparse|subparsers | -1 | 40 | 2 | 72,829,526 | 72,829,526 | 1 | true | 2022-07-01T12:36:49.473Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
How to use sub-commands along with optional positional arguments in argparse<p>Below scripts prints an output as well as opens a webpage based on command lin... |
72,768,801 | C-Style Character String<p>I want to connect two C-style character strings and store the result in a dynamic char array.</p>
<pre><code>int main()
{
char word1[] = "hello";
char word2[] = "haha";
auto ptr = new char[20];
strcpy(ptr,strcat(word1,word2));
cout<<ptr<<endl;
retur... | <p>Like this</p>
<pre><code>strcpy(ptr, word1);
strcat(ptr, word2);
</code></pre>
<p>You need to use <code>ptr</code> for both operations, the copy and the concatenation.</p>
<p>In your version <code>strcat(word1,word2)</code> tries to concatenate <code>word2</code>after the end of <code>word1</code>. But there is no a... | C-Style Character String | c++ | 0 | 40 | 1 | 72,768,843 | 72,768,843 | 2 | true | 2022-06-27T08:04:03.390Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
C-Style Character String<p>I want to connect two C-style character strings and store the result in a dynamic char array.</p>
<pre><code>int main()
{
char w... |
72,772,457 | Pandas reshape extracting multiple values from colname<p>I have a wide dataframe I want to be able to reshape.</p>
<p>I have some columns that I wanna preserve. I have been exploring melt and wide_to_long but I'm not sure that's what I need.</p>
<p>Imagine I have some columns named: 'id', 'classroom', 'city'
And other ... | <p>If you had only 2 parameters to extract, <code>wide_to_long</code> would work.</p>
<p>Here you have 3, thus you can perform a manual reshaping with a MultiIndex:</p>
<pre><code>regex = r'alumn_(\d+)_subject_(\d+)_(.*)'
out = (df
.set_index(['id', 'classroom', 'city'])
.pipe(lambda d: d.set_axis(pd.MultiIndex
... | Pandas reshape extracting multiple values from colname | python|pandas | 2 | 40 | 1 | 72,772,532 | 72,772,532 | 2 | true | 2022-06-27T12:54:39.913Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Pandas reshape extracting multiple values from colname<p>I have a wide dataframe I want to be able to reshape.</p>
<p>I have some columns that I wanna preser... |
72,774,481 | Reshaping an array in Python<p>I am trying to reshape <code>I1</code> from <code>(7,2)</code> to <code>(1,7,2)</code> by means of a variable <code>k</code> which has the shape of old <code>I1</code>. But I get an error. Is there a way to do it?</p>
<pre><code>import numpy as np
I1= np.array([[0, 1],
[0, ... | <p>Because k is a tuple with 2 elements, when it's passed to a function, an asterisk <code>*</code> is needed.</p>
<p>Instead of <code>I1 = I1.reshape(1, k)</code>, try <code>I1 = I1.reshape(1, *k)</code></p> | Reshaping an array in Python | python|numpy | 0 | 40 | 1 | 72,774,565 | 72,774,565 | 2 | true | 2022-06-27T15:15:09.567Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Reshaping an array in Python<p>I am trying to reshape <code>I1</code> from <code>(7,2)</code> to <code>(1,7,2)</code> by means of a variable <code>k</code> w... |
72,771,665 | Access JSONPath firstLevel sons<p>So, I have this answer I want to extract, among other things, the subjects, to test against other answers.</p>
<pre><code>{
"subject": {
"pe": {
"total": 23,
"passed": 2,
"failed": 1,
},
"maths"... | <p>That's pretty simple, here you go:</p>
<pre><code>* def subjects = karate.keysOf(response.subject)
* match subjects == ['pe', 'maths', 'history']
</code></pre> | Access JSONPath firstLevel sons | json|karate|jsonpath | 1 | 40 | 1 | 72,777,437 | 72,777,437 | 2 | true | 2022-06-27T11:55:10.220Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Access JSONPath firstLevel sons<p>So, I have this answer I want to extract, among other things, the subjects, to test against other answers.</p>
<pre><code>{... |
72,780,424 | Stop return information returning when using Set-AzStorageBlobContent<p>I am using Powershell to upload PDF files into a blob storage account using:</p>
<pre><code>Set-AzStorageBlobContent -File <local path> `
-Container "<container name>" `
-Blob <blob name> `
-Context <storage acc... | <p>You can use <a href="https://docs.microsoft.com/de-de/powershell/module/microsoft.powershell.core/out-null?view=powershell-7.2" rel="nofollow noreferrer">Out-Null</a>:</p>
<blockquote>
<p>The Out-Null cmdlet sends its output to NULL, in effect, removing it from the pipeline and preventing the output to be displayed ... | Stop return information returning when using Set-AzStorageBlobContent | powershell|azure-blob-storage | 1 | 40 | 1 | 72,780,441 | 72,780,441 | 2 | true | 2022-06-28T03:25:20.313Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Stop return information returning when using Set-AzStorageBlobContent<p>I am using Powershell to upload PDF files into a blob storage account using:</p>
<pre... |
72,780,536 | React: Passing Props to Components as Items in Object<p>I have something like:</p>
<pre><code>const subMenus = {
"Browse Listings": <MenuSubBrowse />,
"ShowCase": <MenuShowCase />,
"Something Else" : <DummyComponent/>
};
</code></pre>
<p>And would like to pass prop... | <p>You can define a new component and pass props to it</p>
<pre><code>const MenuComponent = subMenus[n.name];
<MenuComponent text='text' />
</code></pre> | React: Passing Props to Components as Items in Object | reactjs | 1 | 40 | 1 | 72,780,569 | 72,780,569 | 2 | true | 2022-06-28T03:47:59.280Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
React: Passing Props to Components as Items in Object<p>I have something like:</p>
<pre><code>const subMenus = {
"Browse Listings": <MenuSubBr... |
72,779,228 | pytorch gives me an error when I don't run it in ~/ directory<p>When I run the following python script in an subdirectory, for example ~/test_dir, python results in an error :</p>
<pre><code>import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super... | <p>It seems that you named your working directory and a script <code>torch</code>. It causes a conflict with the installed Pytorch library, therefore you're calling <em>your</em> <code>torch</code>, not the installed one.</p>
<p>Try it after changing the names of your directory and script.</p> | pytorch gives me an error when I don't run it in ~/ directory | python-3.x|pytorch|pythonpath | 0 | 40 | 1 | 72,783,151 | 72,783,151 | 2 | true | 2022-06-27T23:24:14.557Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
pytorch gives me an error when I don't run it in ~/ directory<p>When I run the following python script in an subdirectory, for example ~/test_dir, python res... |
72,786,396 | Hide border of label<p>I am trying to hide border of label that appears when pressed on. That is, the border around the i button. I have tried setting outline and border to 0 and even to none but nothing works. What am I doing wrong?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-... | <p>I assume you refer to the <code>box-shadow</code> of the <code>a.btn</code>, you can remove it by adding the following CSS rule :</p>
<pre class="lang-css prettyprint-override"><code>.btn:active {
box-shadow: none !important;
-webkit-box-shadow: none !important;
}
</code></pre>
<p><div class="snippet" data-lang=... | Hide border of label | javascript|html|css | 0 | 40 | 2 | 72,786,509 | 72,786,509 | 2 | true | 2022-06-28T12:25:22.517Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
Hide border of label<p>I am trying to hide border of label that appears when pressed on. That is, the border around the i button. I have tried setting outlin... |
72,789,530 | classList.toggle problem with more than one element<p>I am currently trying to style a series of buttons so that when clicked they change to a different style and the text content also changes. It is working except that when I click the another button with the same class, the other button loses its classList toggle. It... | <p>You can assign an eventListener to each button and trigger a function to handle the toggle classList and the button textContent, try this:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-ov... | classList.toggle problem with more than one element | javascript|html|css | 3 | 40 | 1 | 72,789,729 | 72,789,729 | 2 | true | 2022-06-28T15:44:35.380Z | Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
Stackoverflow question:
classList.toggle problem with more than one element<p>I am currently trying to style a series of buttons so that when clicked they change to a different styl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.