nat1

1

votes
2

answer
58

views

How to insert rows at specific positions into a dataframe in Python?

suppose you have a dataframe df = pd.DataFrame({'Name':['Tom', 'Jack', 'Steve', 'Ricky'],'Age': [28,34,29,42]}) and another dataframe df1 = pd.DataFrame({'Name':['Anna', 'Susie'],'Age':[20,50]}) as well as a list with indices pos = [0,2]. What is the most pythonic way to create a new dataframe df...
Nat1
1

votes
0

answer
6

views

Get coefficients of a polynomial pyomo constraint

In addition to the question here I would like to know how to obtain the coefficients of an arbitrary polynomial constraint of a pyomo model. So, for m= ConcreteModel() m.x_1 = Var() m.x_2 = Var() m.x_3 = Var(within = Integers) m.x_4 = Var(within = Integers) m.c= Constraint(expr=2*m.x_1**2 + 5*m.x_1*...
Nat1
2

votes
1

answer
215

views

C# Palindrome Stack not working

i would like your help with my program. I'm trying to check if the user input is a palindrome. This is my code. Stack cstack = new Stack(); Stack rstack = new Stack(); Console.WriteLine('Enter a palindrome string'); string input = Console.ReadLine(); foreach (char c in input) { cstack.Push(c); } for...
nat1