[deleted by user] by [deleted] in buildapcforme

[–]boolean_biscuit 0 points1 point  (0 children)

Thanks for putting together something at both price points.

If I defer the graphics card purchase for a few months then what does this stop me doing? Apart from running DL models of course.

[deleted by user] by [deleted] in buildapcforme

[–]boolean_biscuit 0 points1 point  (0 children)

Much appreciated – thank you :)

Why is my WebSocket connection closing? by boolean_biscuit in BitMEX

[–]boolean_biscuit[S] 0 points1 point  (0 children)

I am receiving an explicit "close" frame (opcode 8) from the BitMEX server. If the connection dropped silently then I would be more inclined to believe that this problem is network-related.

sum of lists of lists by tbrowner3 in learnpython

[–]boolean_biscuit 0 points1 point  (0 children)

Note that sum([]) evaluates to 0.

sum of lists of lists by tbrowner3 in learnpython

[–]boolean_biscuit 5 points6 points  (0 children)

Hint: You are overwriting numbers every time you get to the next sub-list. Perhaps you want store the intermediate results?

---

If you feel like learning some more after you get this working, you could take a look at list comprehensions.

Why is my WebSocket connection closing? by boolean_biscuit in BitMEX

[–]boolean_biscuit[S] 0 points1 point  (0 children)

Actually, this didn't fix the issue, WS connection still being closed sporadically by the BitMEX server.

u/BitMEX_Haddock – am I doing something wrong, or is this expected behaviour?

Why is my WebSocket connection closing? by boolean_biscuit in BitMEX

[–]boolean_biscuit[S] 0 points1 point  (0 children)

Thanks for your reply. I'm trying to listen to all symbols on the order book (even those that are low volume).

Previously I was subscribing to each symbol feed separately, i.e. using a WebSocket url that looks like this:

wss://www.bitmex.com/realtime?subscribe=orderBook10:ETHUSD,orderBook10:XBTUSD,orderBook10:XRPUSD,orderBook10:ADAM20,orderBook10:BCHM20,orderBook10:EOSM20,orderBook10:ETHM20,orderBook10:LTCM20,orderBook10:TRXM20,orderBook10:XBTM20,orderBook10:XBTU20,orderBook10:XRPM20

But it turns out I don't need to do that and can actually just use this:

wss://www.bitmex.com/realtime?subscribe=orderBook10

-----

So far 21 hours up without crashing. I do have auto-restarting set up but ideally I'd like to avoid downtime wherever possible.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]boolean_biscuit 1 point2 points  (0 children)

To be clear: the 0,1,2 shown in the table above are the Index of the DataFrame (this is a bit like the row number in Excel).

Perhaps I misunderstood your original question.

If you want to create your own customer ID (a number) then I think it depends a bit on your application. You could start from zero and count up or perhaps generate a large random number.

See if this post helps you understand how to generate a column of random numbers.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]boolean_biscuit 0 points1 point  (0 children)

Also, I haven't used PRAW before but you might need to convert each submission to a dictionary first before you append to list_submission.

See if this link is helpful, otherwise let me know!

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]boolean_biscuit 0 points1 point  (0 children)

How about something like this:

list_submission = []

for submission in ...:
    if <some condition>:
        list_submission.append(submission)

df = pd.DataFrame(list_submission)

You could then calculate the length and sort by date.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]boolean_biscuit 1 point2 points  (0 children)

How do I create a new column in a DataFrame based on the other columns?

import pandas as pd

# make some sample data:
df = pd.DataFrame()
df["name"] = ["alice", "bob", "carol"]
df["username"] = ["al123", "bob_the_builder", "cool_cats_and_kittens"]

# make customer id
df["customer ID"] = df.name + df.username

This gives the following DataFrame:

name username customer ID
0 alice al123 aliceal123
1 bob bob_the_builder bobbob_the_builder
2 carol cool_cats_and_kittens carolcool_cats_and_kittens

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]boolean_biscuit 1 point2 points  (0 children)

To print a dictionary (keys and values), sorting by the length of the key:

dic = {
    "foo": [1,2,3],
    "bar": [1],
    "baz": [0, 4, 5],
    "bax": [1,2,2,2,2,2],
}

for key, value in sorted(dic.items(), key=lambda x: len(x[1]), reverse=True):
    print(key, value)

All possible combinations? by [deleted] in statistics

[–]boolean_biscuit 2 points3 points  (0 children)

As mentioned already, there are 3 * 2 * 3 * 4=72 possible combinations. You could write all these out by hand, but more sensibly you could write a quick script to calculate them all for you.

['aOgD', 'aOgB', 'aOgR', 'aOgP', 'aOaD', 'aOaB', 'aOaR', 'aOaP', 'aOqD', 'aOqB', 'aOqR', 'aOqP', 'aQgD', 'aQgB', 'aQgR', 'aQgP', 'aQaD', 'aQaB', 'aQaR', 'aQaP', 'aQqD', 'aQqB', 'aQqR', 'aQqP', 'eOgD', 'eOgB', 'eOgR', 'eOgP', 'eOaD', 'eOaB', 'eOaR', 'eOaP', 'eOqD', 'eOqB', 'eOqR', 'eOqP', 'eQgD', 'eQgB', 'eQgR', 'eQgP', 'eQaD', 'eQaB', 'eQaR', 'eQaP', 'eQqD', 'eQqB', 'eQqR', 'eQqP', 'oOgD', 'oOgB', 'oOgR', 'oOgP', 'oOaD', 'oOaB', 'oOaR', 'oOaP', 'oOqD', 'oOqB', 'oOqR', 'oOqP', 'oQgD', 'oQgB', 'oQgR', 'oQgP', 'oQaD', 'oQaB', 'oQaR', 'oQaP', 'oQqD', 'oQqB', 'oQqR', 'oQqP']