I was trying this filter to get the answers of a Stack Overflow user.
But the tags array "tags": [],
is always empty when questions have at least one mandatory tag (for example, see this documentation demo).
How can I get the tags along with the answer?
{
"items": [
{
"tags": [],
"owner": {
"account_id": 10812562,
"reputation": 171,
"user_id": 7952738,
"user_type": "registered",
"profile_image": "https://i.stack.imgur.com/lVbQp.png?s=128&g=1",
"display_name": "DevDengChao",
"link": "https://stackoverflow.com/users/7952738/devdengchao"
},
"down_vote_count": 1,
"up_vote_count": 0,
"is_accepted": false,
"score": -1,
"last_activity_date": 1632710580,
"last_edit_date": 1632710580,
"creation_date": 1632710104,
"answer_id": 69340594,
"question_id": 69340570,
"content_license": "CC BY-SA 4.0",
"link": "https://stackoverflow.com/questions/69340570/calculate-the-sum-in-array-with-condition/69340594#69340594",
"title": "Calculate the sum in array with condition",
"body": "<p>Maybe you are looking for a <code>reduce</code> or <code>groupBy</code> function.</p>\n<p>Btw, it's clear and it works, man, why troubleing yourself and making it a little bit harder to maintain.</p>\n"
},
{
"tags": [],
"owner": {
"account_id": 18052725,
"reputation": 11,
"user_id": 13122002,
"user_type": "registered",
"profile_image": "https://lh3.googleusercontent.com/a-/AOh14Gg8PdwxNmPOSKuMqrpKi4vseiljtsjMRQLnXS5I=k-s128",
"display_name": "Let's L.C.E",
"link": "https://stackoverflow.com/users/13122002/lets-l-c-e"
},
"down_vote_count": 0,
"up_vote_count": 0,
"is_accepted": false,
"score": 0,
"last_activity_date": 1632710574,
"last_edit_date": 1632710574,
"creation_date": 1612824636,
"answer_id": 66110503,
"question_id": 53218570,
"content_license": "CC BY-SA 4.0",
"link": "https://stackoverflow.com/questions/53218570/how-to-convert-number-1-to-a-boolean-in-python/66110503#66110503",
"title": "How to convert number 1 to a Boolean in python",
"body": "<p>To convert <code>1</code> to boolean type:</p>\n<pre><code>print(bool(1))\n</code></pre>\n<p>Which returns <code>True</code>.</p>\n"
},
{
"tags": [],
"owner": {
"account_id": 448551,
"reputation": 1574,
"user_id": 842808,
"user_type": "registered",
"accept_rate": 79,
"profile_image": "https://www.gravatar.com/avatar/86bc1885f9caab6706e51fab0601e307?s=128&d=identicon&r=PG",
"display_name": "Abhinav",
"link": "https://stackoverflow.com/users/842808/abhinav"
},
"down_vote_count": 0,
"up_vote_count": 0,
"is_accepted": false,
"score": 0,
"last_activity_date": 1632710562,
"creation_date": 1632710562,
"answer_id": 69340637,
"question_id": 2459851,
"content_license": "CC BY-SA 4.0",
"link": "https://stackoverflow.com/questions/2459851/octave-matlab-extend-a-vector-making-it-repeat-itself/69340637#69340637",
"title": "Octave / Matlab: Extend a vector making it repeat itself?",
"body": "<h2>Although late, I am posting this because this turned out to be the most popular answer to a similar question <a href=\"https://stackoverflow.com/q/10316128/842808\">here</a>.</h2>\n<p><strong>This is a Faster Method Than <code>repmat</code> or <code>reshape</code> by an Order of Magnitude</strong></p>\n<p>One of the best methods for doing such things is Using <a href=\"http://www.ee.columbia.edu/%7Emarios/matlab/Matlab%20Tricks.pdf\" rel=\"nofollow noreferrer\">Tony's Trick.</a> I came across this trick in one of the Electrical Engineering course lectures notes of Columbia University. Repmat and Reshape are usually found to be slower than Tony's trick as it directly uses Matlabs inherent indexing. To answer you question,</p>\n<p>Lets say, you want to tile the row vector <code>r=[1 2 3]</code> <code>N</code> times like <code>r=[1 2 3 1 2 3 1 2 3...]</code>, then,</p>\n<pre><code>c=r'\ncc=c(:,ones(N,1));\nr_tiled = cc(:)';\n</code></pre>\n<p>This method has significant time savings against <code>reshape</code> or <code>repmat</code> for large <code>N</code>'s.</p>\n<p>I conducted a small Matlab test to check the speed differential between <code>repmat</code> and <code>tony's trick</code>. Using the code mentioned below, I calculated the times for constructing the same tiled vector from a base vector <code>A=[1:N]</code>. The results show that YES, Tony's-Trick is FASTER BY AN ORDER of MAGNITUDE, especially for larger N. People are welcome to try it themselves. This much time differential can be critical if such an operation has to be performed in loops. Here is the small script I used;</p>\n<pre><code>N= 10 ;% ASLO Try for values N= 10, 100, 1000, 10000\n\n% time for tony_trick\ntic;\nA=(1:N)';\nB=A(:,ones(N,1));\nC=B(:)';\nt_tony=toc;\nclearvars -except t_tony N\n\n% time for repmat\ntic;\nA=(1:N);\nB=repmat(A,1,N);\nt_repmat=toc;\nclearvars -except t_tony t_repmat N\n</code></pre>\n<p>The Times (in seconds) for both methods are given below;</p>\n<ul>\n<li>N=10, time_repmat = 8e-5 , time_tony = 3e-5</li>\n<li>N=100, time_repmat = 2.9e-4 , time_tony = 6e-5</li>\n<li>N=1000, time_repmat = 0.0302 , time_tony = 0.0058</li>\n<li>N=10000, time_repmat = 2.9199 , time_tony = 0.5292</li>\n</ul>\n<p>My RAM didn't permit me to go beyond N=10000. I am sure, the time difference between the two methods will be even more significant for N=100000. I know, these times might be different for different machines, but the relative difference in order-of-magnitude of times will stand. Also, I know, the avg of times could have been a better metric, but I just wanted to show the order of magnitude difference in time consumption between the two approaches. My machine/os details are given below :</p>\n<p><em>Relevant Machine/OS/Matlab Details</em> : Athlon i686 Arch, Ubuntu 11.04 32 bit, 3gb ram, Matlab 2011b</p>\n"
},
{
"tags": [],
"owner": {
"account_id": 13125518,
"reputation": 742,
"user_id": 9481613,
"user_type": "registered",
"profile_image": "https://lh3.googleusercontent.com/a-/AOh14GjFWZ7udq84X5Ysni5L9gmx-8sykZfNRCy4IvUv=k-s128",
"display_name": "mLstudent33",
"link": "https://stackoverflow.com/users/9481613/mlstudent33"
},
"down_vote_count": 0,
"up_vote_count": 0,
"is_accepted": false,
"score": 0,
"last_activity_date": 1632710552,
"creation_date": 1632710552,
"answer_id": 69340635,
"question_id": 43877288,
"content_license": "CC BY-SA 4.0",
"link": "https://stackoverflow.com/questions/43877288/how-to-hide-android-statusbar-in-flutter/69340635#69340635",
"title": "How to hide Android StatusBar in Flutter",
"body": "<p>Some of the above is deprecated in favor of:</p>\n<pre><code>SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,\n overlays: [SystemUiOverlay.bottom]);\n</code></pre>\n<p>What I am finding strange is that I placed this in <code>initState</code> of my second screen rather than in <code>void main</code> of the app but it is applied to all my screens nonetheless.</p>\n<p><a href=\"https://api.flutter.dev/flutter/services/SystemChrome/setEnabledSystemUIMode.html\" rel=\"nofollow noreferrer\">https://api.flutter.dev/flutter/services/SystemChrome/setEnabledSystemUIMode.html</a></p>\n"
},
{
"tags": [],
"owner": {
"account_id": 6768404,
"reputation": 16484,
"user_id": 5212614,
"user_type": "registered",
"accept_rate": 32,
"profile_image": "https://i.stack.imgur.com/2qaHz.jpg?s=128&g=1",
"display_name": "ASH",
"link": "https://stackoverflow.com/users/5212614/ash"
},
"down_vote_count": 0,
"up_vote_count": 0,
"is_accepted": false,
"score": 0,
"last_activity_date": 1632710538,
"creation_date": 1632710538,
"answer_id": 69340634,
"question_id": 69321407,
"content_license": "CC BY-SA 4.0",
"link": "https://stackoverflow.com/questions/69321407/converting-lists-of-categorical-data-to-numeric-vectors-with-unlabeled-data/69340634#69340634",
"title": "Converting lists of categorical data to numeric vectors with unlabeled data",
"body": "<p>You can easily convert all columns in dataframe into categories. Here is a simple code sample.</p>\n<pre><code>import pandas as pd\n \n# Intitialise data of lists\ndata = [{'Year': 2020, 'Airport':2000, 'Casino':5000, 'Stadium':9000, 'Size':'Small'}, \n {'Year': 2019, 'Airport':3000, 'Casino':4000, 'Stadium':12000, 'Size':'Medium'},\n {'Year': 2018, 'Airport':5000, 'Casino':9000, 'Stadium':10000, 'Size':'Medium'},\n {'Year': 2017, 'Airport':5000, 'Casino':10000, 'Stadium':15000, 'Size':'Large'}]\ndf = pd.DataFrame(data)\n\n\ndf = df.set_index(['Year'])\ndf\n</code></pre>\n<p>Result:</p>\n<p><a href=\"https://i.stack.imgur.com/fElnA.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/fElnA.png\" alt=\"enter image description here\" /></a></p>\n<pre><code>df_fin = pd.DataFrame({col: df[col].astype('category').cat.codes for col in df}, index=df.index)\ndf_fin\n</code></pre>\n<p>Result:</p>\n<p><a href=\"https://i.stack.imgur.com/gxz9s.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/gxz9s.png\" alt=\"enter image description here\" /></a></p>\n"
},
{
"tags": [],
"owner": {
"account_id": 8252,
"reputation": 35823,
"user_id": 14768,
"user_type": "registered",
"accept_rate": 82,
"profile_image": "https://i.stack.imgur.com/b6aMa.png?s=128&g=1",
"display_name": "Joshua",
"link": "https://stackoverflow.com/users/14768/joshua"
},
"down_vote_count": 0,
"up_vote_count": 0,
"is_accepted": false,
"score": 0,
"last_activity_date": 1632710534,
"creation_date": 1632710534,
"answer_id": 69340633,
"question_id": 69340108,
"content_license": "CC BY-SA 4.0",
"link": "https://stackoverflow.com/questions/69340108/how-to-check-if-character-read-in-through-read-system-call-is-a-backspace/69340633#69340633",
"title": "How to check if character read in through read system call is a backspace?",
"body": "<p>You can check if it's a backspace by looking for character number 8 (ASCII). It's written in C as '\\b'.</p>\n<p>However did you forget to put your terminal in RAW mode?</p>\n"
},
{
"tags": [],
"owner": {
"account_id": 16805054,
"reputation": 6295,
"user_id": 12149471,
"user_type": "registered",
"profile_image": "https://www.gravatar.com/avatar/5bb9107b3d75e1de3585ba0f14e9d632?s=128&d=identicon&r=PG&f=1",
"display_name": "Andreas Wenzel",
"link": "https://stackoverflow.com/users/12149471/andreas-wenzel"
},
"down_vote_count": 0,
"up_vote_count": 0,
"is_accepted": false,
"score": 0,
"last_activity_date": 1632710528,
"last_edit_date": 1632710528,
"creation_date": 1632709543,
"answer_id": 69340554,
"question_id": 69340407,
"content_license": "CC BY-SA 4.0",
"link": "https://stackoverflow.com/questions/69340407/how-do-you-write-a-program-that-tests-if-a-users-inputs-are-integers-and-return/69340554#69340554",
"title": "How do you write a program that tests if a user's inputs are integers and returns a message if they enter characters?",
"body": "<p>The function <a href=\"https://en.cppreference.com/w/cpp/string/byte/isdigit\" rel=\"nofollow noreferrer\"><code>std::isdigit</code></a> expects an <code>int</code> with the value of a character code. However, you are not passing it a character code. If you want to pass a character code, you must read the input as a string or as individual characters, not as a number. Otherwise, you will have no character codes to pass to <code>std::isdigit</code>.</p>\n<p>However, unless the task description explicitly requires you to check that every single character is a digit, you don't have to call <code>std::isdigit</code>. This would also not be meaningful in some cases. For example, when the user enters negative numbers such as <code>-34</code>, the first character is not a digit. With this specific task, where the user is supposed to enter numbers between <code>0</code> and <code>100</code>, there should be no negative numbers, but the user may want to enter <code>+34</code> for the number <code>34</code>, which should also be valid (unless the task description explicitly says otherwise).</p>\n<p>You have two options to solve this problem. You can either</p>\n<ol>\n<li>rely on the stream extraction operator <code>>></code> and check whether an error occurred by checking <a href=\"https://en.cppreference.com/w/cpp/io/basic_ios/fail\" rel=\"nofollow noreferrer\"><code>cin.fail</code></a>, or</li>\n<li>read one line of input using <a href=\"https://en.cppreference.com/w/cpp/string/basic_string/getline\" rel=\"nofollow noreferrer\"><code>std::getline</code></a> and use <a href=\"https://en.cppreference.com/w/cpp/string/basic_string/stol\" rel=\"nofollow noreferrer\"><code>std::stoi</code></a> to attempt to convert the string into to a number. The function <a href=\"https://en.cppreference.com/w/cpp/string/basic_string/stol\" rel=\"nofollow noreferrer\"><code>std::stoi</code></a> will tell you whether the input was valid or not, i.e. whether it was possible to convert the string to a number.</li>\n</ol>\n<p>The first option may be easier to use, but the second option is generally recommended for line-based user input.</p>\n<p>However, both options do have one problem: They will accept input such as <code>6sdfh4q</code> as valid input for the number <code>6</code>. Therefore, if you want perfect input validation, you should also check the part of the input that was not converted to a number, to check whether it is acceptable. In that case, all whitespace characters are probably harmless, but all other characters are not, so I recommend that you use <a href=\"https://en.cppreference.com/w/cpp/string/byte/isspace\" rel=\"nofollow noreferrer\"><code>std::isspace</code></a> for this purpose.</p>\n"
},
{
"tags": [],
"owner": {
"account_id": 9913598,
"reputation": 11,
"user_id": 7339346,
"user_type": "registered",
"profile_image": "https://www.gravatar.com/avatar/b4b434c2e36e180e1b413183a755d1ae?s=128&d=identicon&r=PG&f=1",
"display_name": "Tejas Narayanan",
"link": "https://stackoverflow.com/users/7339346/tejas-narayanan"
},
"down_vote_count": 0,
"up_vote_count": 0,
"is_accepted": false,
"score": 0,
"last_activity_date": 1632710526,
"creation_date": 1632710526,
"answer_id": 69340631,
"question_id": 69340545,
"content_license": "CC BY-SA 4.0",
"link": "https://stackoverflow.com/questions/69340545/k-means-algorithm-in-python-returning-typeerror-list-object-is-not-callable/69340631#69340631",
"title": "K-Means Algorithm In Python returning TypeError: 'list' object is not callable",
"body": "<p>It seems that you haven't posted the snippet of code where the error actually occurred. But based on the error message, you might have created a <em>list</em> called <code>kmeans_cluster</code>, which conflicts with your function name. That might be why it's trying to "call" your list, because even though you intend for it to be using the <code>kmeans_cluster</code> function, it's actually using the <code>kmeans_cluster</code> list (which can't be called).</p>\n<p>Again, this is mostly speculation based on the error message, since you haven't posted the code preceding the error message. But inspect your code for conflicting variable and function names.</p>\n"
},
{
"tags": [],
"owner": {
"account_id": 22118428,
"reputation": 812,
"user_id": 16372109,
"user_type": "registered",
"profile_image": "https://i.stack.imgur.com/nzydo.jpg?s=128&g=1",
"display_name": "HatLess",
"link": "https://stackoverflow.com/users/16372109/hatless"
},
"down_vote_count": 0,
"up_vote_count": 0,
"is_accepted": false,
"score": 0,
"last_activity_date": 1632710521,
"last_edit_date": 1632710521,
"creation_date": 1632709598,
"answer_id": 69340559,
"question_id": 69340094,
"content_license": "CC BY-SA 4.0",
"link": "https://stackoverflow.com/questions/69340094/keep-current-and-previous-line-only-if-current-line-fulfills-a-given-condition/69340559#69340559",
"title": "Keep current and previous line only if current line fulfills a given condition",
"body": "<p>Is <code>perl</code> an option?</p>\n<pre><code>perl -nle '$prev && print if length() >50 and length() < 800 && print $prev; $prev = $_' input_file\n</code></pre>\n<p><code>$prev</code> - Create a variable which will hold every line. When the length condition is met, and there has been a previous line <code>$prev</code>, then it prints the condition matched in <code>$prev</code> and prints the last line.</p>\n<p><code>$prev = $_</code> Assigns the current line to the <code>prev</code> line variable</p>\n<hr />\n<p>If the upper limit <code>800</code> is not essential, could <code>sed</code> be an option?</p>\n<pre><code>$ sed -En '/>/ {N;/[a-zA-Z0-9]{50,}/p}' input_file\n</code></pre>\n<p><code>/>/</code> - Match <code>></code> and read into the pattern space</p>\n<p><code>N;</code> Run the condition on the next line after the match and append that to the pattern space also:</p>\n<p><code>{50,}</code> - If the length is 50 or more</p>\n<p><code>\\1/p</code> - Return it and print</p>\n<hr />\n<p><strong>Output</strong></p>\n<pre><code>>4RYF_2\nMNLIPTVIEQTSRGERAYDIYSRLLKDRIIMLGSAIDDNVANSIVSQLLFLDAQDPEKDIFLYINSPGGSISAGMAIYDTMNFVKADVQTIGMGMAASMGSFLLTAGANGKRFALPNAEIMIHQPLGGAQGQATEIEIAARHILKIKERMNTIMAEKTGQPYEVIARDTDRDNFMTAQEAKDYGLIDDIIINKSGLKGHHHHHH\n</code></pre>\n"
}
],
"has_more": true,
"quota_max": 10000,
"quota_remaining": 9952
}