« first day (2644 days earlier)      last day (2311 days later) » 
00:00 - 16:0016:00 - 00:00

12:19 AM
Is there a way to configure PyCharm to use relative imports instead of absolute imports? Whenever I use the refactor feature to move a file to a different location, all the imports are changed to absolute ones
 
12:40 AM
When using np.histogram the length of my counts (bin values) are less than my bins, even though I'm explicitly using 256 bins (Image values). Am I supposed to use 257 bins?

img = Image.open(file_name)
img.load()
bw = img.convert('L')
bw_data = np.array(bw).astype('float32')

BINS = np.array(range(0,256)) #


counts, pixels =np.histogram(bw_data, BINS) # len(counts) = 255 len(pixels) =256
 
 
1 hour later…
1:49 AM
Hi everyone
I think I found a bug in the cmd module for python
Where can I submit a bug report?
 
DSM
Officially, bugs.python.org. But depending on how confident you are, it might be worth asking a Q on SO first (as a kind of early triage.)
 
I'm pretty sure
I found a bug that has two parts on bugs.python.org
And this was one part
But the bug was resolved by addressing only the other part
If that makes sense
 
DSM
Then it definitely sounds like it's worth a followup. Just make sure to make it super-obvious in your post exactly what the problem is that the posted solution doesn't fix.
 
@DSM I reported the bug here: bugs.python.org/msg309788 . Let me know if this is a proper bug report and if it's appropriate to tag onto the old issue
 
cbg
 
2:00 AM
This is my first python bug report, so a bit uncertain about the process, etc
 
@BlackSheep good spot !
 
DSM
I've reported a few but I have to admit I don't know much about the cmd module, never having used it. :-)
 
Thanks for the help, all. If anyone sees this later and it's wrong, feel free to message me (on SO, email, wherever) and I'm happy to move it to the right place
 
DSM
Looks fine to me, and I'm sure you'll get directions on the ticket itself (you're automatically added as nosy, I think) if there's something else they need to know.
 
 
2 hours later…
3:40 AM
Should I have a sandwich or pho for dinner?
 
DSM
For some reason I always think of sandwiches as a lunch food, not a supper food. YMMV, of course. ;-)
 
pho it is!
it helps that the place is named "Hot as Pho"
 
DSM
I don't know the text emoticon for eyeroll, so I'll go with :eyeroll:
 
(-: 🙄
rbrb for pho
 
DSM
Rhubarb!
 
4:37 AM
recbg
 
 
2 hours later…
6:25 AM
recbg
 
cbg @cᴏʟᴅsᴘᴇᴇᴅ
 
One of my pandas answers is now in the HNQ queue
 
why do I not know what HNQ is?
 
I just felt like Oprah
 
6:33 AM
I think I'm missing something!
 
You get a vote, you get a vote, and you get a vote, ...
 
I was hesitant to say it at first. But like Oprah showering her fans in dollar bills
 
yes
 
Heheh... but it was a good question. Shows you the spirit of the pandas tag and its answerers
There's no way any of those answers would've had nearly as many votes if us answerers had not voted on the others' answers
 
yes. I'd like to think that I helped foster that.
 
6:40 AM
I believe with every fibre of my being that you were instrumental in facilitating that level of sportsmanship
 
That truly does make me feel good. I appreciate that (-:
 
@piRSquared No prob! Also, I see you've been busy with the answers today. That's awesome to see.
 
I was motivated for some reason
 
The crowd's been good today, almost every asker within the last 6 hour period has accepted answers
 
Isn't that funny? Sometimes you get rashes of questions that are just all garbage or questioners who just abandon their own question.
 
6:49 AM
Indeed...
 
I'm going to post some answers to that question. But look at this one, I think it's fun.
pd.concat([pd.Series(dict.fromkeys(*t)) for t in df.values])
It doesn't nail the columns without some more accounting work. But I'm working on it
 
Clever... but will this work if you have an index element with repeated characters? "aabb" for example.
Since you convert the slice to a dict.., there's a possibility you drop rows
 
Nice, that looks clear and succinct.
 
7:05 AM
Of course you know your answer is where my brain went first (-:
 
I was the last one to answer before you, so I was surprised that the others hadn't thought of it yet
 
I like Alexander's solution as well. Mine mimics his, but performance for mine is killed because I'm adding lists. I'm only adding lists to keep it generalized.
Ok, I might be wrong I tested it over the small data and its virtually identical even when I take out the list addition
 
7:25 AM
@cᴏʟᴅsᴘᴇᴇᴅ
df = pd.DataFrame(1, range(3), range(3))
np.fill_diagonal(df.values, 0)
df

   0  1  2
0  0  1  1
1  1  0  1
2  1  1  0
non-mixed typed dataframes -> df.values returns a view
 
Oh... thanks
uff, incomplete answer, I feel bad when I do that. Let me edit
 
Hi Can anyone guide me how to extract discount from text file using nlp
I am using pattern matching to extract but it is not working
 
Write a question which describes your problem here, they can help you.
Also, if you are unsure what to expect from this chatroom, check out the room rules
 
7:48 AM
ohh I am sorry
 
no problem =)
 
8:03 AM
@Moondra try len(range(0,256))
 
(The 0 is redundant)
 
recbg
 
8:19 AM
cbg
 
@Moondra oh nevermind, you're right that it's length-256. So look at the docs of histogram: "If bins is a sequence, it defines the bin edges, including the rightmost edge, allowing for non-uniform bin widths.". For 256 bins you need 257 edges
 
8:35 AM
Can you suggest why both other answers (and even the question) got upvotes and not my answer! — rnso 3 mins ago
Does this seem like an attempt to ask for votes?
 
tbh it sounds like that person is convinced that their answer is better than the other two
 
@cᴏʟᴅsᴘᴇᴇᴅ Not explicitly
 
cbg
 
Hammerworthy, you think?
 
The OP's probably going to ask for help in the comments if you hammer it, but yes, it's definitely a duplicate
 
Does someone know how clearbit works
 
okay, done.
 
9:06 AM
bleh, I really can't find a straightforward "how do I access a certain element in nested json" question. Guess I'll have to suck it up and accept that that's going to be our canonical from now on.
 
9:24 AM
Quick question folks-I have python 2.7 and in an answer to a question I asked on SO somebody gave the following line of code: for filename in os.listdir(subdir, destination_subdir):. This works find in 3.4 but I can't get it to work in 2.7, anybody know does 3.4 allow two arguments but 2.7 doesn't? Thanks
 
According to the docs it doesn't accept 2 arguments in python 3.4
Might be a bug?
 
That's strange, it's working for me in 3.4 but not in 2.7
 
It wouldn't be the first time they accidentally exposed some additional parameters *shrug*
 
9:45 AM
destination_subdir doesn't make sense as an argument to os.listdir
I don't believe that it's working, even in Python 3.4
os.lisdir(subdir, destination_subdir) this seems wrong — vaultah 25 secs ago
Why didn't you ask the answerer ...?
 
10:26 AM
hello i got a problem, maybe someone has encountered something similar
we have a production database and server(psql & django) and now i need to move that to a test enviroment
the problem is when we copied our database
and try to run migration on them
when i "create" a new table the migration seems to execute sucessfully
but the table itself is not create and later on when i want to change something it says it cannot find the mentioned table
everything else seems to work okay
all the data is there and i can save/read without any problems
 
That sounds like something you should ask about on the main site, with proper details.
 
@cᴏʟᴅsᴘᴇᴇᴅ no
 
11:04 AM
@vaultah I did but didn't get a response. It definitely did work in 3.4
 
Cabbage
 
cbg, poke
 
 
1 hour later…
12:36 PM
Is it possible to share a jupyter notebok with other people on ones local network? Without the person you sharing it with have to download jupyter notebook?
I just ran jupyter notebook and created a local server 8888-something but why can't I share it ?
 
maybe it binds to localhost?
 
@thiefmaster how do I check if that is the case "http://localhost:8888/notebooks/Jupyter%20Notebook/Untitled.ipynb?kernel_name=p‌​ython3"
 
lunchcbg
You need to do jupyter notebook --ip <your_LAN_ip> --port 8888
 
Sebastian can always use some do-your-own-research practice
 
--ip 0.0.0.0 usually works as well, 0.0.0.0 == bind to all ips
 
Heh, sorry.
 
first I thought "meh, should grab some lunch" but then I realized I have leftover pizza
 
1:07 PM
<<< eating salad, as is the tradition in January.
 
Did you mess up your resolutions? ;)
 
Nawh, just three months of sitting within arms-reach of the biscuit tin while I was writing up my PhD has put considerable strain on my waistband. I'm running a half marathon in April as penance.
Turns out, running is easier if you're carrying less dead weight around. rolls eyes
 
Well, PhD is a bit of a vis major so it's fine ;)
 
It's certainly a unique life-circumstance.
 
Pet peeve of the day: "an unique"
 
1:24 PM
I said (would've said) "usurp" wrong until the age of 28 or so
(I blame nightwish)
 
Any recommendations on dash frameworks in python? I loved the look of PyDashie, but it's not very well documented and mostly moribund. Plotly dash feels ok, I guess, django-dash is not quite batteries-included enough for me from a styling pov.
 
I have a long history of pronouncing words wrong because I'd only seen them written down.
 
@AndrasDeak see also 'Detritus', i blame pratchett.
 
Oh yeah, that too. I heard that first a few months ago in one of the Okeanos Explorer livestreams :|
 
(Actually, I just had to double check that I'd remembered that right)
Same, Kevin.
 
1:26 PM
but at least we know how to pronounce Latin properly so it's English that is wrong in that case
 
apropos of nothing
 
Does the person I share the link to my jupyter notebook local server has to have installed the jupyter notebook on his machine?
I tried sending this link but he couldn't reach the server: "http://127.0.0.1:8888/"
When I enter it in my own address bar it works just fine.
 
works for me too
 
lol
 
1:34 PM
did you read what I wrote?
 
Yes
It didn't work
 
that's because 127.0.0.1 isn't your network IP
 
127.0.0.1 (or anything between 127.0.0.0 and 127.255.255.255) is a special IP that is also called "localhost". It just means that the server is running locally on your computer, it is not a public IP and it cannot be accessed from the internet in general.
 
like how your router's address is usually something like 192.168.0.1 - your machine will have a network address. You can get it from ifconfig or similar.
 
The easiest solution may be hosting the notebook here nbviewer.jupyter.org
 
1:36 PM
hmm okay thanks for the suggestions
 
true hero
 
But it won't be interactive in nbviewer.jupyter.org. If you need it to be interactive, you'll have to setup an actual public Jupyter server. Look up how to do that.
 
oersted that is what I am trying to do.
 
Perhaps it would be useful to split this task in two. First, figure out how to host a resource, any resource at all, that can be accessed by your coworker. Then swap out that resource for the actual notebook you want to host. This will help you determine whether the current problem is because of general network mis-configuration, or something specific to Jupyter
 
1:37 PM
what OS are you on, Sebastian?
 
Live share a jupyter notebook with a person on my local network.
windows
 
View network connections -> select connection -> details will give you the internal IP.
 
I feel as if I need a shower…
 
I am sorry, I cannot give specific instructions off the top of my head. Let me do a quick lookup.
 
Epic answer poke.
 
1:39 PM
I just googled "jupyter notebook local network". Try to search a bit before asking next time please.
 
^^ literally the answer I lifted mine from.
 
I'll try that.
 
@Oersted you'd be surprised how many times he's already heard that here
 
Yeah you are right withn
You wrote that earlier
 
Alright, I'm in a generous mood, why doesn't that work @SebastianNielsen?
 
1:41 PM
I think it was because I didn't type my local ip
 
What's the problem with that answer?
 
Jul 25 '17 at 19:56, by davidism
Do research before you ask. Have a basic understanding before you ask. Don't answer if these two things are obviously not fulfilled.
 
I am re-trying it, this time typing in my local ip
 
I mean, that wasn't related to Sebastian, just general guidelines ^
 
@AndrasDeak at least he didn't actually post a duplicated question...
 
1:42 PM
I have dict in following form >>> orfr
OrderedDict([(1, ("5' > 3' ", '793', 804, 4, 1, 'ATGCA...TAAAAG')), (19, ("5' > 3' ", '4768', 4782, 5, 1, 'ATGCT...TAATAA')), (26, ("5' > 3' ", '6781', 6789, 3, 1, 'ATGGA...TAACAC'))])
 
@Oersted I think you summoned a demon by saying that ^^
 
It works now
 
I want to replace modify first value part of each value i.e 5' > 3' how this can be done?
 
Of course it does XD...
 
I was so stupid to forget to write my own local ip
hehe
I just wrote the ip of my gateway
 
1:44 PM
@AmmarSabirCheema Replace with what?
 
@AmmarSabirCheema loop over orfr.items() and do the needful?
 
with 3 > 5
 
So just replace the first element of the tuple with "3 > 5" in all circumstances?
 
@Withnail Thanks :)
 
but tuple does not allow replacement
 
1:45 PM
yeah, you need to construct a new value for each key
 
But the bad thing about is, that you can't view the other persons live edits.
 
>>> for i in orfr.items(),orfr1.items:
... orf[numorf][0] = "5\'> 3'"
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
TypeError: 'tuple' object does not support item assignment
 
>>> from collections import OrderedDict
>>> orfr = OrderedDict([(1, ("5' > 3' ", '793', 804, 4, 1, 'ATGCA...TAAAAG')), (19, ("5' > 3' ", '4768', 4782, 5, 1, 'ATGCT...TAATAA')), (26, ("5' > 3' ", '6781', 6789, 3, 1, 'ATGGA...TAACAC'))])
>>> result = OrderedDict((k, ("3 > 5",) + v[1:]) for k,v in orfr.items())
>>> result
OrderedDict([(1, ('3 > 5', '793', 804, 4, 1, 'ATGCA...TAAAAG')), (19, ('3 > 5', '4768', 4782, 5, 1, 'ATGCT...TAATAA')), (26, ('3 > 5', '6781', 6789, 3, 1, 'ATGGA...TAACAC'))])
 
Oh my, it's the first time I'm here... What a shitshow...
 
I should probably mooch over to severfault. I have nginx/AWS pains I must resolve. Things are redirecting that should not be redirecting.
 
1:47 PM
@Oersted welcome to the python room I guess :P
 
@Oersted If you're saying "There are many questions being asked in here that are not up to my standards", it's not always like that :-)
 
Indeed. Sometimes the questions are nothing at all to do with python but very high quality.
 
Yeah, we usually just spend a lot of time starring Kevin’s random rambling
10
 
and apparently a few Kevin-related non-Kevin messages
 
Speaking of Kevin’s stars, there’s not a single post on the current star board!? Are you broken @Kevin?
 
1:49 PM
For some reason when two help seekers arrive in quick succession, it feels ten times as hectic than if they had appeared separately
@poke Nah all part of my natural cycle. I'm only funny for one period every 13 years. Then I burrow into the warm earth.
 
uhhm
 
Took me a long time to find the soil at Home Depot with the best Wifi signal permittivity
 
Kevin must have been one of the kaiju in Cabin in the Woods
 
I can just imagine some poor weekend kid working there being like, "Oh damnit, there's a Kevin in the soil again. Mr Peeeeeeeeetersonnnnnnnn!"
 
Why not use cables? You are already below the surface?
 
1:53 PM
user image
7
 
=0
and here I was thinking that was just a joke. spooky.
 
Cables... Now there's an idea
 
Amazing.
 
well_there_it_is.gif
 
Is it possible to share a jupyter notebook in which you can see the other persons live edits?
 
1:56 PM
He only shows up in a deleted scene, alas
 
I can succesfully share one, but I can't view any live edits.
 
Have you tried turning it off and on again?
 
._.
stop da trolling.
 
start researching
 
Sharing live edits seems like one of those features that, if you can't quickly determine whether it's possible or not, it probably isn't possible. But that's only my gut feeling.
 
1:58 PM
I have, but I can't find anything..
 
This is not jupyter helpdesk. Or <Sebastian's weekly problem> helpdesk.
 
I don't begrudge questions related to Python appearing in the Python room. But the askers also need to accept that sometimes nobody has any helpful input. And that goes double if it's related to a specific environment/IDE
 
And if said asker had already gotten valid responses (to different problems) half an hour earier, only to ignore them altogether
 
Also, an answer is easily googleable on this, just read beyond the first result.
 
If we can answer a general Python question with a 33% success rate, and only 10% of us use Jupyter with any regularity, then you're down to 3.3% right there
 
2:03 PM
@Kevin I think we have a few people with a higher individual success rate, but those are also likely not using Jupyter
So, yes, 3.3% seems accurate
 
Maybe I'm overly permissive of questions that should have been googled first, because I'm regularly guilty of that over in the C# room
 
Didn't help that I barged in like the Kool-Aid guy trying to be helpful.
 
My "solving the problem yourself a second before submitting the question" reaction is two seconds too slow over there
 
bah I forgot all about that pizza
rhubarb for a bit
 
How could you forget pizza?!
 
2:15 PM
I found an interesting scipy function :(
 
@Kevin thanks for the code it works fine.
 
Glad to hear it
 
\o cbg
 
cbg
 
2:30 PM
Sometimes I feel like introducing type hinting in python was a mistake. Is this right here expected behavior? If yes, why even bother?
def ret_float() -> float:
    return 0
print(type(ret_float()))
>> <class 'int'>
 
Type hints are just hints
 
ret_float() is 0 is an int, that's all that type sees
it can't be anything other than type(0)
also recbg
 
@ArneRecknagel stackoverflow.com/a/32558710/2301450 refer to the "Why Type Hints?" section.
 
Is there any situation where type hints have any effect on the behavior of the program? Serious question, I haven't used hints since their introduction.
My expectation is that they have as much power as a comment saying #this function returns a float
 
class A:
    def method(self, arg: A):
        pass
Boom, NameError
 
2:36 PM
@Kevin Only if you use inspection in your code to validate them :P
 
@vaultah You got me there. Now, is there any situation where type hints have an effect other than "cause an error when the hint is evaluated because you didn't declare it right"?
 
> While these annotations are available at runtime through the usual __annotations__ attribute, no type checking happens at runtime. Instead, the proposal assumes the existence of a separate off-line type checker which users can run over their source code voluntarily
Probably not
 
Ok, that's in the neighborhood of what I expected
 
for the time being
 
Accessible in the same way docstrings are: possible, but you better have a good reason for doing it
 
2:43 PM
So it really is 100% equivalent to a docstring sections like """ var (int): bla bla """
 
No
 
Oct 11 '16 at 17:26, by DSM
I'm on record as being willing to take good odds on the fact that the "we don't intend to make putting type declarations everywhere the new default" promise isn't worth the paper it's not printed on.
 
If you're writing an introspective type checker, you'd prefer hints over docstrings because then you don't have to write a parser :-)
 
if they do become the default, I'm sure they will have more aggressive consequences
 
please no, I like my variables to be free
 
2:45 PM
Type validation will always be a separate step in Python
 
Ain't nobody got time to do re.match(r"var \(\w+\): .*?", docstring)
 
Maybe we’ll get a python -t file.py at some point in the future but it will never be the default
 
why do we have to conform our variables at such a young age right when we create them. maybe x didn't want to be an int
 
python truly was ahead of its time
 
oh why won't anyone think of the variables.
 
2:48 PM
Primary reason is that nobody wants to rewrite the stdlib to have type hints on everything
 
The whole reason why I even tried type hinting is because I wanted to check if dataclasses are useful. Now I can't decide whether to use the class' docstring to document my args or type hinting.
I upgraded my pycharm for this =(
 
You use docstrings to document the arguments, you use type hinting to document types.
 
While I wait for stackoverflow.com/q/48209497/953482 to provide an MCVE, I thought I'd ask: Are the string representations of pandas objects trivially reversible? In other words, should I be able to unambiguously get the value of a from the repr that the OP made available here? Some kind of handy pd.unserialize method, maybe?
 
I followed the google stylesheet for docstrings, which included type hinting. It would be strange to omit it now.
I guess I'll have to live with the duplication
 
that's subterfuge in order to make Go more successful
 
2:53 PM
I see questions posed this way fairly frequently: they show the printed version of the dataframe or series or whatever, but don't show how they created the object. Are they assuming that I can easily reproduce the object? Or are they just being inconsiderate?
 
My money is on "inconsiderate"
 
> `PEP 484`_ type annotations are supported. If attribute, parameter, and
return types are annotated according to `PEP 484`_, they do not need to be
included in the docstring:
 
No, they don't know any better
 
I could have answered this question in thirty seconds if it was on regular lists and not this MCVE-less arcane third party collection type
 
@AndrasDeak Thanks, I missed that part!
 
2:55 PM
@Kevin protip: pandas.DataFrame(dct) creates a dataframe where the keys are the column names and values are the column values
That was my primary hurdle to answering pandas questions. I figured this out, then I realized that I don't know pandas.
 
Relatable. Half of the libraries I've installed, I installed in the hopes that I could answer a quick question about them. My success rate in that category is about 5%
 
I use these functions as quick ways to parse dataframes. They work for most unless a MultiIndex columns or index object is present.
idx0 = partial(pd.read_clipboard, index_col=0, engine='python')
clip = partial(pd.read_clipboard, engine='python')
sep2 = partial(pd.read_clipboard, sep='\s{2,}', engine='python')
s2i0 = partial(pd.read_clipboard, sep='\s{2,}', engine='python', index_col=0)
s2i0d0 = partial(pd.read_clipboard, sep='\s{2,}', engine='python', index_col=0, parse_dates=[0])
 
that looks nice
 
Ah, so pandas does have some text-table parsing support. But somehow I suspect it doesn't play nice with naked datetimes.
 
that's Ultra Nightmare difficulty
 
3:00 PM
Hmm I was hoping that read_table would accept a string but I think it wants a file :-I
 
io.StringIO?
the scientific python stack usually plays nice with that
 
Copy/Paste the input from that question and use
`idx0(parse_dates=[0], header=None, names=['Date', 'ColA'])` where `idx0` is from my function list above and get...
            ColA
Date
2017-12-31    10
2018-01-01     9
2018-01-02    15
2018-01-03    25
2018-01-04    30
 
Ooh nice
 
of course the healthy approach would be badgering askers until they come back with a runnable example :P
 
Just trying to put an extra chamber in my fast-gun :-)
 
3:04 PM
Which is why I'm not answering it. They probably are asking for exponentially weigthed mean
 
cbg
 
s = idx0(parse_dates=[0], header=None, names=['Date', 'ColA']).ColA
s.ewm(alpha=.1).mean()

Date
2017-12-31    10.000000
2018-01-01     9.473684
2018-01-02    11.512915
2018-01-03    15.434719
2018-01-04    18.991478
Name: ColA, dtype: float64
I think that's what they want... I think. But I'm not motivated to prod them to the point of confirming and making the effort
 
one thing I really don't get... people who get sick in the cold but decide to live in New England
 
There’s also people who get sick in the heat
 
3:08 PM
yep that's me which is why I stay in a more mild climate area... I would die somewhere like Arizona or LA
 
I can't stand the heat
 
(I wanted to express that the temperature has little to do with getting sick)
 
I dunno I notice as soon as it drops below like 10C some people are just in a constant state of being sick
 
I moved to Seattle for work 7 years ago. I recently moved my family back down to Southern California and now I commute every other week for 4 days. I love dry heat over cold
humidity on the other hand... stinks
 
Curious. Changing out read_clipboard for read_table turns all my numbers into NaNs.
s = """2017-12-31 10
2018-1-1 9
2018-1-2 15
2018-1-3 25
2018-1-4 30"""

a = pd.read_table(StringIO(s), index_col=0, engine='python', parse_dates=[0], header=None, names=['Date', 'ColA'])
print(a)

#result:

               # ColA
# Date
# 2017-12-31 10   NaN
# 2018-1-1 9      NaN
# 2018-1-2 15     NaN
# 2018-1-3 25     NaN
# 2018-1-4 30     NaN
 
3:11 PM
nani
 
you missed the separator
 
Humidity + heat is the actual worst, by far
 
eeeuughhhh, yes.
 
@Kevin add , sep='\s+'
 
also I'm going to Germany, any cool things to do in Germany?
 
3:13 PM
Oh, ok. idx0 wasn't created with a separator... Is it supplied by default for read_clipboard?
 
yup
 
default for read_clipboard is whitespace
 
read_clipboard(sep='\\s+', **kwargs)
 
Whoops I'm in "should have googled it" territory, sorry
 
the difference is that we know and love you, Kevin :P
 
3:15 PM
@corvid skiing
 
@corvid Depends where exactly you are
 
@corvid eating ice cream
 
I'm going to Germany too, next week
 
@ArneRecknagel Munich probably
 
just make sure to drink all the beer you're offered
 
3:15 PM
Wow, why are you all coming here?
 
@corvid Ha, I lived there for 2 years
 
I don't really like German beer :\ more of a fan of Dutch style beer
 
don't tell that to the Germans
 
yeah, that part feels slightly awkward, pretty much only like Imperial Stouts
 
What's the difference in style?
 
3:16 PM
Bavarians might actually take offense. Especially if you call the dutch laced-water a beer
 
@poke family business in my case
 
But plenty to do in munich. Plenty of nice museums, theater if you enjoy that, just bumbling around over the markets and shopping streets, and the BOB (bayerische oberlandbahn) gets you into the alps in ~45 minutes
 
@Kevin when you get around to answering that question. I still suspect that a[i] is a mistake on OP's part, I think they meant b[i]=b[i]*0.1+b[i-1]*0.9 which is stock standard exponentially weighted moving average which is covered with pandas pd.Series.ewm method. As I showed above.
 
I’m in Munich next week
 
Now that I have code that actually creates a (no help from OP on that btw >_>), I can confirm that I have no idea how to write a beautiful one-liner when I'm operating on serieses instead of good old lists
 
3:20 PM
I've been to Munich, though I mostly saw the Ludwig-Maximilians-Universität then
 
I studied there! =0 Small world
 
Andras' "I figured this out, then I realized that I don't know pandas" predicted the outcome perfectly
 
@ArneRecknagel what's the deal with all the Germans speaking perfect english? I am so perplexed
 
*writing ;)
 
3:23 PM
Thanks =)
In my case, english media >>> german media. So it was learn english or be bored
 
I've heard some wonky German accents
 
@corvid sorry.
 
@Kevin I'm pretty sure you can just listcomp over the series and put the result back in a new series ;)
 
when I was looking for a job I interviewed with a few German companies... I thought the people were American but they were actually German (living in Germany) but spoke English perfectly
 
List comp's a little sketchy since it needs the previous value of b to calculate the current value of b
 
3:25 PM
ah
 
I bet itertools.accumulate could do something here
 
I'm fairly sure a Series already has methods for that
 
import itertools
a = [10, 9, 15, 25, 30]
print(list(itertools.accumulate(a, lambda x,y: x*0.1 + y*0.9)))
#[10, 9.1, 14.41, 23.941, 29.3941]
Something like that. I don't know if it's right since OP didn't actually show his expected output
 
hmm, no it doesn't
 
what post is this
 
3:26 PM
0
Q: Replace while loop in series calculation

AlessandroI would like to understand how to replace this simple while loop with less characters. a: 2017-12-31 10 2018-1-1 9 2018-1-2 15 2018-1-3 25 2018-1-4 30 I would like to replace this code with a shorter code: b=pd.Series(index=a.index) b[0]=0 i=1 while i< len(b): b[i]=a[i]*0.1+b[i-1]*0.9 ...

Even after taking my best shot at parsing a, I still get KeyError: 1 when assigning to b
 
I am guessing expected output is [0, 1.0, 1.8, 3.12, 5.308, 7.7772]
(not sure about how Pandas works but I'm just using a list there to synthesize)
 
I wager 2.3 quatloos that piRSquared has magically determined what the OP actually wanted to do
 
it annoys me that numpy arrays don't have an .abs()
 
We may never know since OP's last comment makes it sound like he gave up on finding the answer, and has vanished forever into the mists
 
le shrug
 
3:35 PM
I couldn't leave it without answering.
 
I like your reprimand at OP for not providing a setup for a. I wanted to break out the ClueBat myself.
 
is quatloos SOPython's cryto currency and instead of running calculations on our GPU, we solve answers and Kevin divides up the loot ?
 
If I/(We) didn't do that, half of the pandas questions would go unanswered. There are many decent questions hiding underneath horrible question construction. My main motivation is to provide a quicker way for other potential answerers to take a stab at answering it.
 
Quatloos are slightly more illusory than ordinary currency. Rather than a symbolic mutually shared illusion that everybody shares, it's a symbolic illusion that only I believe in.
 
but that's the thing, if we start to believe and share it's value it will become a thing :D
 
3:42 PM
Since my fiscal policy is "manufacture currency out of thin air and hand it out on a mere whim", I can't recommend using them for anything other than "burn for warmth"
Each quatloo comes with an assembly payload containing the "Halt and catch fire" opcode
 
If that happens you need to duck, type and roll
 
mmm duck roll
 
I'm just reading here about "halt and catch fire", and I run into a killer @poke
 
Ah, OP emerged from the mists. In lieu of quatloos, I'll give pi a +1
 
(-: I was going to pass. but OP's "ok, i thought there where something more shorter! ty " pulled at my heart-strings
 
DSM
3:55 PM
Morning not-even-sure-why-I'm-saying-cabbage-because-I'm-off-to-an-hour-long-meeting-and‌​-then-lunch cabbage.
 
I think it's appropriate to say cbg+rbrb
 
#AllCabbagesMatter
 
cbgrbrb
cbgr brb
 
DSM
Maybe it's just delayed subway annoyance. Fire investigation at a station slowed the main line, so I'm way late to the office.
 
cbg, DSM
 
3:59 PM
cbg :D
 
We don't have fire investigations at subway stations. We do have fires though.
 
00:00 - 16:0016:00 - 00:00

« first day (2644 days earlier)      last day (2311 days later) »