« first day (4267 days earlier)      last day (688 days later) » 

12:04 AM
Anybody familiar with psychopy (psychopy.org/index.html)?
 
12:42 AM
how can i plot a graph to see the evolution of my ga?
https://pastebin.com/QaUVmDhL
 
 
9 hours later…
10:05 AM
Hello, when I want to transform my timestamp 1652659260000 it gets transformed to 1.1.1970, but it should be 16 May 2022
Can someone help me to transfer the values correctly? I used: df['Open_time'] = pd.to_datetime(df['Open_time'])
 
@Baobab please read the docs of to_datetime() very carefully first. See if any parameters look relevant to you.
 
There's also an example with Unix timestamp right on that page
 
@Thorsen you store the x and y values you want to plot in a list, then use matplotlib to plot y vs x. But looking at that code you shouldn't be using dicts with keys 'x' and 'y', you should use 2-length tuples instead. Then you can do things like x_new, y_new = old_position etc. It would also make unpacking a bunch of such tuples simpler, using a single zip instead.
 
@AndrasDeak--СлаваУкраїні I did study it carefully
 
10:25 AM
Here's a hint: Unix timestamps are usually floating point numbers, but yours is an int. Why?
 
@Aran-Fey it's not uncommon they get multiplied to be whole milliseconds (hence that one ending 0000)
 
10:45 AM
Yeah I know. The question is whether Baobab does
 
we may never do given the silence :)
 
Does anyone knows an algorithm for that? Given a positive integer n, 0<n<1000. Find the smallest positive integer m such that the product nm has all digits in increasing or decreasing order and algorithm works in a modern laptop in less than one second.
sorry, 0<n<10000
 
11:03 AM
wouldn't that just be 1 ?
 
What does "has all digits in increasing or decreasing order" mean? Does it mean that all possible digits, i.e. 0-9, occur in that order, or that only the digits present are in that order?
 
Aren't there a lot of numbers that don't have a solution? For example, what's the result for n = 101?
Oh, I guess it doesn't have to be strictly increasing/decreasing, then 11, 22, 33, etc. are all valid solutions
Are we sure the algorithm isn't just "try all the numbers"? What's the largest m you can get?
Ok never mind, there are some tough ones like 9898
 
11:28 AM
I'm still stuck, sorry. My timestamp is a int at the beginning but I transform it to a datetime. But as soon as I do this, as I said, its defaulted to 1970 which is not correct
 
Do you know what a timestamp is? Say you have the timestamp 1234.5. What does that timestamp mean?
 
It is the time, not human-readable, but the code for the time of a machine
If anyone knows the answer to my problem, please let me know. i highly appreciate it
 
I see you're not interested in learning anything. Ok then
 
? I don't understand this comment of yours.
 
@Baobab Did you check out the pd.to_datetime example on Unix timestamps? Do you notice any arguments being used that your call doesn't supply?
 
11:35 AM
@MisterMiyagi Yes, one can regulate the "origin" in the code; which is usually set to 1970, so far so good. But I tried to change it in different ways, which gives either an error or remains at 1970..
The rest of the arguments for datetime is not needed in my case (referring to pandas.to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False, utc=None, format=None, exact=True, unit=None, infer_datetime_format=False, origin='unix', cache=True)[source])
Also when I alternate the UTC argument it stays at 1970
 
So I mean 101 has not digits in inreasin or decreasing order but 110 has.
 
Well now I don't understand the question at all anymore. I though the goal was to find an integer m so that 101 * m becomes sorted. But there's no m so that 101 * m = 110
 
@Aran-Fey Just read the question carefully. 101*11=1111 and 11 is the smallest positive integer n such that 101*n has digits in increasing or decreasing order.
 
101*11 = 1111
yeah, that
 
So what was that about 110?
 
11:44 AM
just an example that they don't need strict monotonicity
 
110*1=110.
 
Ok
 
@Baobab hint: look more closely at the unit argument...
 
@Baobab The origin argument is not used in the Unix timestamp examples.
 
you guys are really patient
 
11:48 AM
I'm through two days of downtime maintenance. Sleep deprivation and patience just depend on the point of view.
 
There must be a doctor hiding nearby, making us all patients...
 
Hey Doc
 
12:42 PM
Jaakko's question is interesting... The straightforward approach works fine for the first thousand Ns or so. Then it hits N=1089, and churns indefinitely. I let it run for five minutes before I terminated the program.
Maybe I can integrate the accepted answer at stackoverflow.com/questions/47947473/… somehow...
This reminds me of the Project Euler question that asks you to find the largest number in a Hailstone Sequence with starting value n. The straightforward approach works great, until the thousandth N or so, at which point the result is too large to fit in a four byte int. Not a problem for Python, big problem for C and its descendants.
 
1:39 PM
I've got two solid approaches now, and both hang for 1089. I'm starting to think it has no solution.
 
I think I can find a valid n*m, but it won't be the smallest
 
>>> 1089*9182736455463728191
9999999999999999999999
next hanger is 2178
oh that's not even close to being optimal
At least judging by some other hits. This is from my "smart" solution which gives 1088 * 914 == 994432 whereas the "dumb" one finds 1088 * 5 == 5440
 
Looking for 999...999s is the approach I was going for :-) IIRC, there's always a 9-repunit that's divisible by X, for any X that's coprime with 10
 
huh, never heard of that one
 
terminology correction: "repdigit", not "repunit". A repunit's repeating digit is always 1. A repdigit's can be any digit.
"9-repdigit" is semi-fake terminology I made up because I couldn't find a concise noun meaning "a repdigit whose repeating digit is 9"
9-repdigits are useful for working with repeating decimals. 7 * 142857 = 999999, so 1/7 = 0.142857142857142857...
(Not pictured: the big pile of arithmetic necessary to prove this)
 
1:59 PM
OK, fixed my "smart" solver
 
1/7              =      0.142857142857142857...
1/7 * 10^6       = 142857.142857142857142857...
1/7 * 10^6 - 1/7 = 142857
1/7 * (10^6 - 1) = 142857
10^6 - 1 = 7 * 142857
999999 = 7 * 142857
 
Ok, proving it only requires a little pile of arithmetic. Finding the magic value 142857, when all you have to start with is 7, is the annoying part
 
I thought 1/7 gives you the magic value
 
It does, but it can get hairy if you've got a big denominator, and/or floating point decides to be extra imprecise that day
You could implement a perfect-precision long division algorithm, if you can figure out how to stop when you enter a cycle. Caffeinated Kevin can do it, but Baseline Kevin can't.
 
2:10 PM
@AndrasDeak--СлаваУкраїні this is the lowest solution. My fixed solver got it in 9.5 minutes.
 
Interesting. I guess 999...999 is the worst-case scenario for the straightforward solver.
 
The non-problematic cases on the other hand run for a couple of dozen milliseconds at most. One could write an ugly solution that first finds the 9-repdigit solution, then spends the rest of the one second looking for smaller solutions. If there's none found in that time frame, return the 9-repdigit :P
@Kevin the straightforward (as in brute force) solver will take a lot longer to reach 9182736455463728191. Couple of heat deaths of the universe, I think.
(nah, maybe just a few years)
 
My solver will devote 1% of its processing ability towards finding a way to reverse entropy, so it can run even after heat death
 
If the problem as asked by Jaakko is solvable, there has to be some "cute" "math trick" that makes this O(1), or at least O(log N).
 
I feel like prime factorizations are involved somehow. 1089 = 33^2. I am very suspicious of this nice tidy square.
It is a multiple of both 9 (the supremely suspicious number) and 11 (known accessory)
 
2:20 PM
next hanger is 2178 which is not a square
 
Possibly useless observation: if X evenly divides a 9-repdigit, then X/9 evenly divides a 1-repdigit. For instance, 1089/9 = 121, and 121*9182736455463728191 = 1111111111111111111111
 
2178 * 45913682277318640955 == 99999999999999999999990, almost 15 minutes. Note the 0 at the end.
 
Crazy how nature do that
 
up next 3267 :P
I'd like to see the "runs in 1 second" solution that finds that for 2178
if it were either 9-repdigits or something small I'd say "fine"
 
2178 = 2*9*11*11. Maybe all numbers of the form 2^a * 5^b * 1089 are expensive.
 
2:30 PM
I don't see the connection between the first and second parts of your message
 
Valid, I left out various assumptions
Perhaps I should have written the first equation as 2178 = 2^1 * 5^0 * 1089
 
2:51 PM
Aaah, I see
3267 is another multiple of 1089, right?
Good catch
 
3:15 PM
The Stackoverflow survey results are in, in case anyone is interested.
3
 
3:43 PM
def elitism(best_individual, population):

idx_draw = random.randint(1, population_size-1)
population.pop(idx_draw)
population.append(best_individual)

return population

is there any problem of doing it like that instead of doing it with
#population[idx_draw] = best_individual
 
4:00 PM
Those two do different things, so the primary problem is that you cannot use either in place of the other.
The first will insert best_individual at the end, the second will insert it at idx_draw.
 
I'm curious why you're passing 1 to randint instead of 0.
 
4:19 PM
@Kevin yes, i also want to know why i did it
it'll never change the 0 position
@MisterMiyagi got it ty
 
user17416440
5:03 PM
Hi. I have a shared folder in Google Drive that works fine with Google Colab. But I want to use Jupyter Lab (by Amazon SageMaker Studio Lab to be precise). However I failed to find relevant information that how I can upload google drive data to my account? The files are very large (3.5gb).
 
user17416440
if someone can help me out I would be grateful
 
user17416440
The only solution so far is to download all data to my PC and then reupload it on my studiolab account, which can easily take my 2,3 days
 
perhaps do a search for "connect to google drive python" and see what comes up
 
user17416440
The thing is I am using Sagemaker Studiolab resources to use Jupyterlab. I have to upload on studiolab
 
what programming language are you using on that platform?
 
user17416440
5:14 PM
Python.
 
then my statement applies. treat it like a simple "how do i access this data on google drive" type of deal.
 
user17416440
Deep Learning Object detection, semantic segmentation to be precise
 
user17416440
Okay let me try :)
 
8:42 PM
@Kevin total runtime 2 hours
and here are the multiples of 1089 (first column n, second column is the matching multiple, third column is the monotonic product):
1089 9182736455463728191 9999999999999999999999
2178 45913682277318640955 99999999999999999999990
3267 69727578818487909397 227799999999999999999999
4356 229568385878991939598 999999888888888888888888
5445 18365472910927456382 99999999999999999999990
6534 153045607591045131449 999999999999888888887766
7623 58454676636494818313 445599999999999999999999
8712 114784192939495969799 999999888888888888888888
9801 56799192939495969799 556688889999999999999999
@AndrasDeak--СлаваУкраїні 2.5...
 
... Andras has taken this seriously
The graphs are basically consultancy-ready :P
 
8:58 PM
if I do something I might as well do it properly :P
 
9:12 PM
I have two dataframes with variables = ID, From, To, Value1, Value2, Value3 (length data). if I have one ID that is repeated in both dataframes with not all overlapping intervals but some, how do I tell it I want to use dataframe 2 to update only the overlaps (even if they come in the middle of an interval).
pandas?
 
@CelesteWilson are you asking "pandas?"? Because if yes, then what do you mean by "dataframe"?
 
9:25 PM
Andras' question is really pertinent but it's much easier to fix upstream if they come from SQL queries
Otherwise I think you'd need to take several passes at the df
But, yeah, it's unclear
 
https://stackoverflow.com/questions/72721011

what else can I do when OP has already found the duplicate, claims not to understand how to apply the duplicate, but the reasons given for not understanding (or for thinking the situation is special) are clearly nonsense?
 
If it's a clear dupe, leave it closed as a dupe. If you feel like being helpful try to explain in comments, or invite them to chat. Otherwise just move on.
 
9:44 PM
ok, I guess I'm done with it then
 
@roganjosh we are trying to automate a python workflow, I know how I would do it in SQL, trying to figure out how to do it in python. If i have to do multiple passes, that's ok
 
Have you tried anything?
I am gonna clock off at this point and can try pick this up tomorrow, but not without a minimal example and what foobar'd with the attempt
 
no worries, I'll post what I've tried. Testing something else now
Just been trying different things using this as a guidance
 
"this" being an impending link to some resource?
Or just chat
Because, in the latter case, that's not research at all. It's just asking others to contribute their own approach
 
well it worked for House, MD
 
@AndrasDeak--СлаваУкраїні he carries his bitterness better than I do
It's not Lupus, though. I can confidently say that
 
Okay, so what is the actual problem that needs to be solved? What are you "automating"?
 

« first day (4267 days earlier)      last day (688 days later) »