Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
1 answer
45 views

const cart = ["shoes","shirts","boxers","pants"] function creatOrder(cart){ return new Promise((resolve,reject)=>{ if(!ValidateCart(cart)){ ...
Grimmj0w's user avatar
0 votes
0 answers
20 views

My background is in SQL and I was wondering what was the most efficient/readable way of creating multiple columns using the same window partition within a pandas chain. Suppose I have the following ...
gjk515's user avatar
  • 23
2 votes
2 answers
108 views

I am aware that I can use method chaining by simply having methods return self, e.g. object.routine1().routine2().routine3() But is it possible to organize methods into layers or groups when applying ...
The Central Scrutinizer's user avatar
0 votes
0 answers
47 views

I'm building my own ORM in Python and ran into an issue. I want to track the access to class variables in order to know which ForeignKey is being used in each part of my code. class IQuery(ABC): &...
phzamora's user avatar
0 votes
2 answers
187 views

I often want to both manipulate and display a dataframe during a sequence of chained operations, for which I would use*: df = ( df #Modify the dataframe: .assign(new_column=...) #View result ...
MuhammedYunus's user avatar
2 votes
0 answers
68 views

What is the preferred syntax to filter a polars Series without referencing the Series explicitly? I.e. something that works with method chaining. I thought pipe would be an option but it is not ...
mouwsy's user avatar
  • 2,127
1 vote
0 answers
107 views

After I've concluded a block with method chaining, VSCode keeps the indentation until I format on save. Example: $orders = Order::paid() ->notShipped() ->get(); dd($orders); // <-...
Sebastian Stoll's user avatar
0 votes
1 answer
52 views

I know of 2 ways that are not very convenient and look inelegant: Via then: (new TestClass).syncMethod().asyncMethod().then(self => self.anotherSyncMethod()) Via await: (await (new TestClass)....
a4356's user avatar
  • 75
1 vote
4 answers
223 views

I am working in C#. And I have a scenario as shown here: var response1 = service.AddSchool(object model, string a); if (response1.StatusCode == HttpStatusCode.OK) { var response2 = service....
sunil's user avatar
  • 163
0 votes
1 answer
58 views

I'm working on a Python project that involves processing large numpy arrays using a chain of transformations. I've implemented two classes: Sample for individual arrays and SampleCollection for ...
Ikaryssik's user avatar
3 votes
2 answers
284 views

When writing a program, I often want to perform a series of steps on a piece of data (usually a list or string). For example I might want to call a function which returns a string, convert it to a ...
David Moneysmith's user avatar
1 vote
4 answers
132 views

I have a chain of methods that treat an array. Then I was trying to do a simple thing: add an element at the start of the array in a method chain. Initially I tried: console.log( [1, 2, 3] ...
Nelson Teixeira's user avatar
1 vote
1 answer
414 views

I noticed that it's possible to use df.rename(columns=str.lower), but not df.rename(columns=str.replace(" ", "_")). Is this because it is allowed to use the variable which stores ...
mouwsy's user avatar
  • 2,127
1 vote
2 answers
279 views

I am coming to Python from F# and Elixir, and I am struggling heavily in terms of cleanly coding data transformations. Every language I have ever used has had a concept of a pipeline operator and/or ...
bmitc's user avatar
  • 908
2 votes
5 answers
85 views

I have a dataset: import pandas as pd data = [ ('A', 'X'), ('A', 'X'), ('A', 'Y'), ('A', 'Z'), ('B', 1), ('B', 1), ('B', 2), ('B', 2), ('B', 3), ('B', 3), (...
R_Student's user avatar
  • 809
1 vote
2 answers
114 views

I have a Pandas DataFrame with the following structure: import pandas as pd data = { 'glob_order': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], 'trans': ['A', 'A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', '...
R_Student's user avatar
  • 809
0 votes
1 answer
70 views

in some sources such as the original article of Martin Fowler aren't written that methods would return the same object, and methods in examples return different objects but in some sources(newer) such ...
Gor Madatyan's user avatar
1 vote
1 answer
119 views

When I read about it on Wikipedia, it seemed to me that these two are almost the same, but the same article says that they differ not only in the use of DSL. Note that a "fluent interface" ...
Gor Madatyan's user avatar
2 votes
3 answers
238 views

Is it possible to copy a dataframe in the middle of a method chain to a new variable? Something like: import pandas as pd df = (pd.DataFrame([[2, 4, 6], [8, 10, 12], ...
mouwsy's user avatar
  • 2,127
-1 votes
2 answers
158 views

I'm new to Python and I come from the R environment. One thing that I love in R is the ability to write down code that will make some many transformations on the data in one readable chunk of code But ...
R_Student's user avatar
  • 809
2 votes
1 answer
378 views

Now that append() is removed in pandas 2.0, what is a short alternative to append() allowing method chaining? The "What’s new in 2.0.0" section of pandas says: Removed deprecated Series....
mouwsy's user avatar
  • 2,127
1 vote
3 answers
108 views

In the following toy example, i'm trying to add a status column based on the outer merge results. The challenge is to preserve the chaining method as best described in tom's blog. The commented out ...
gregV's user avatar
  • 1,117
0 votes
0 answers
51 views

I would like to understand when a copy constructor or assignment is called. Assume the following: class Foo { public: Foo() { cout << "foo constructor " << this <&...
Sam's user avatar
  • 1
1 vote
1 answer
218 views

I am spinning up on Python and Spark. I noticed that Python uses a lot of chaining of methods and/or properties. A lot of what I found online about this for Python describes method cascading, even ...
user2153235's user avatar
  • 1,285
0 votes
1 answer
181 views

So let's say I have this MWE code: # see below for full code - not important here class RealEstate; attr_accessor :name; attr_accessor :living_space; attr_accessor :devices; def initialize(name, ...
sb813322's user avatar
  • 129
-2 votes
1 answer
82 views

I would to know how to simplify theses function calls by chaining them. Is there a way to chain forEach, push, destructuring array and map. let selectorsForLoader = ['a', 'b']; let loadingElements = ...
Dotista's user avatar
  • 451
3 votes
2 answers
722 views

For pandas DataFrames in python, multiple member methods have an inplace parameter which purportedly allow you to NOT create a copy of the object, but rather to directly modify the original object*. [*...
mpag's user avatar
  • 571
2 votes
1 answer
955 views

Ok I'm really struggling to find clear documentation to help me understand what's going on here. gen_events.append(shared.gradio['Generate'].click( ui.gather_interface_values, [shared.gradio[k] for ...
averagescripter's user avatar
0 votes
0 answers
807 views

I can't create a Map method for a generic stlice in go for fluent style programming (method chaining). For example look at the code snippet I've created for the Filter method: package main import &...
Baron's user avatar
  • 19
1 vote
1 answer
121 views

I'm trying to determine if it is possible in Ruby to determine when a chain of methods has finished being called. Consider that I have a class which retrieves information from a database. I often just ...
Brayw's user avatar
  • 135
0 votes
1 answer
183 views

I have a GAS time based trigger that I would like to run at intervals of some combination of hours and minutes (i.e. the triggered function would run every 2 hours and 30 minutes, or every 4 hours and ...
Ian Propst-Campbell's user avatar
0 votes
0 answers
110 views

Currently I have a python class function where class Data: def __init__(self, data=None, target=None): self._data = None self._target = None self.X = data ...
Kritik Seth's user avatar
1 vote
1 answer
134 views

I would like to do something like obj.WithX().WithY().WithZ(). obj can have different types, which is why I am using an interface. Unfortunately obj can also be nil. In that case my method chaining ...
User12547645's user avatar
  • 8,745
0 votes
1 answer
174 views

I am trying to perform a post request, obtain the ids set as the primary key back, and use these to populate a different table through a different API. I have read this and this SO posts, as well as ...
BobiBo's user avatar
  • 1
0 votes
2 answers
85 views

I have a notebook that I am converting using chaining in pandas. Minimally, it looks like this: df = (pd.read_csv("../data/stones_raw.csv", index_col=[0]) .drop(['date', 'id'], axis=1) ...
hrokr's user avatar
  • 3,629
0 votes
3 answers
283 views

I have the following data frame. col1 col2 col3 1 1 1 2 2 2 3 1 2 3 3 3 I want to replace numerical values based on the following mappings col1: {1: dog, 2: cat, 3: bird} col2:...
Eisen's user avatar
  • 1,947
1 vote
2 answers
90 views

I have the following data frame: Data Frame: id animal 1 dog 2 cat 3 rabbit 4 horse 5 fox I want to replicate each id 3 times. How can I do this in pandas using method chaining? Expected output: ...
Eisen's user avatar
  • 1,947
4 votes
2 answers
186 views

It is common for libraries to have types which return instances of themselves from member functions to encourage chaining calls. For example, nlohmann json: auto my_data = my_json_object["first ...
xzaton jw's user avatar
0 votes
1 answer
379 views

I would like to create a custom api service that will work similarly to the supabase-js library. Example: const { data, error } = await supabase .from('cities') .select('name, countries(*)') .eq(...
Matej's user avatar
  • 280
1 vote
3 answers
279 views

I have a pandas data frame, where some string values are "NA". I want to replace these values in a specific column (i.e. the 'strCol' in the example below) using method chaining. How do I do ...
packoman's user avatar
  • 1,292
1 vote
3 answers
136 views

I want to create a new column named total which adds all the year columns (everything in these columns are integers). I want to do it dynamically because as each year passes there will be a new column ...
Eisen's user avatar
  • 1,947
1 vote
1 answer
42 views

I have the following method chaining code and want to create a new column. but i'm getting an error when doing the following. ( pd.pivot(test, index = ['file_path'], columns = 'year', values = '...
Eisen's user avatar
  • 1,947
0 votes
3 answers
473 views

I'm developing .NET core app that using selenium, so I've designed the logic using fluent interface that make the code more readable and maintained. I have a problem which is how to make a conditional ...
Karim Fahmy's user avatar
2 votes
2 answers
4k views

I have recently tried to create a simple builder pattern that allows for chaining methods together. The API for it should look similar to this: let chained = MethodChainer::new() ....
nir shahar's user avatar
1 vote
3 answers
600 views

I currently have a data frame like so: treated control 9.5 9.6 10 5 6 0 6 6 I want to apply get a log 2 ratio between treated and control i.e log2(treated/control). However, the math.log2() ratio ...
KLM117's user avatar
  • 497
-2 votes
1 answer
49 views

method chaining requires every method to return the jquery object but, when we use: $("div").click(function(){ //some code }).css("backgroundColor","blue"). how does the ...
Maghawry Hussein's user avatar
-4 votes
1 answer
83 views

Edited to comply with the rules: How can I chain the following code? I cannot seem to be able to add new column with chain. Input columns of Dataset: ORDER, ITEM_SERIAL, DATE %%time df = Dataset....
Very_new_to_this's user avatar
1 vote
1 answer
286 views

I want to aggregate a pandas DataFrame using method chaining. I don't know how to start with the DataFrame and just refer to it when aggregating (using method chaining). Consider the following example ...
Emman's user avatar
  • 4,313
2 votes
3 answers
173 views

I would like to fill column b of a dataframe with values from a in case b is nan, and I would like to do it in a method chain, but I cannot figure out how to do this. The following works import numpy ...
divingTobi's user avatar
  • 2,350
0 votes
1 answer
153 views

Right now my df looks like this (I shorten it cause there are 20 rows). import pandas as pd df=pd.DataFrame({'Country': ["Uruguay", "Italy", "France"], 'Winner': ["...
Chery's user avatar
  • 5

1
2 3 4 5
14