« first day (2894 days earlier)      last day (2053 days later) » 

wim
8:00 PM
@Aran-Fey thanks for the bounty. cha-ching!
 
I gave you a little extra because the answer was better than I hoped :)
 
@SShah I've used eyed3, but that was a few years ago, so I'm pretty hazy on the details. But I agree that the docs are pretty patchy & confusing. I'll try to remember to take a look at your question tomorrow. I turned my computer off a few minutes ago (I'm on my phone now).
 
DSM
Does anyone have strong preferences regarding XML generators?
 
Avoid at all cost. Oh, that's XML in general, nevermind.
 
@PM2Ring Thank you very much, if you do find a solution, kindly please answer at my post on the main site because I feel it would help several others. And yeah I do agree, the docs are not straight forward to understand, I wish they had some examples there. I was looking at another module called Mutagen, but from the look of it I am not sure if it is used to tag, it rather seems like a module to retrieve tag info. Anyways, Thank you and really appreciate the help :)
 
wim
8:07 PM
Kevin's suggested pattern with keyword-only arguments is quite nice for the cooperative inheritance. You won't see it in the wild much, though, because most big codebases still promise to support 2.7.
 
@SShah I can't promise anything, but I wrote a couple of little demo programs while I was figuring stuff out, and maybe one of those does image manipulation. Or maybe I never worked out how to do that, and used a mp3 tagging GUI program to do that stuff. ;)
 
wim
It's a cleaner way of popping out of **kwargs - they never go in kwargs if the matching name was in signature.
 
@DSM It is a bit of an odd combo, bash + bc is the usual idiom.
 
@PM2Ring Haha no worries, hopefully you can help me out, if not I still appreciate all the help and effort :)
 
wim
@DSM I would rather that, than python calling bash to do arithmetic ... :P
I have seen people calling os.system to do stuff like 'cat somefile | wc -l'
 
DSM
8:10 PM
:-P I'm used to bash/awk/sed programs and Python programs, and I've definitely called Python programs from bash before.. but not quite like this.
 
I mostly avoid XML, although I do stuff with SVG from time to time. Mostly hand-written, but occasionally generated using Python. But I don't use a library for that, just print & f-strings.
IIRC, some brave soul wrote a scientific calculator using sed. Which is pretty impressive when you consider that sed has no support for arithmetic, so you have to do any arithmetic with pattern matching & replacement.
Incrementing non-negative integers isn't that hard, but I'd hate to try doing anything more complicated.
 
A calculator? meh. 2048 though
 
Wow!
 
    s/:(.)...:(.)...:(.)...:(.).../& \4\3\2\1:/
    s/:.(.)..:.(.)..:.(.)..:.(.).. .*/&\4\3\2\1:/
    s/:..(.).:..(.).:..(.).:..(.). .*/&\4\3\2\1:/
    s/:...(.):...(.):...(.):...(.) .*/&\4\3\2\1/
oh, it's written in braille
 
There's no way I can name my module with an initial number and be able to import it, right? Other than maybe __import__ shenanigans
 
8:25 PM
two_module.py
 
Hi, please don't hate me for my off-topicness
Which would be the closest to a "meta" chatroom?
 
@bsam chat.MSE, Tavern on the Meta
 
I can't seem to find any
@Andr
@AndrasDeak thanks!
 
chat.SO is programming-only mostly meta.stackoverflow.com/questions/374045/…
No worries. You can edit/delete messages in chat for 2 minutes.
 
wim
@AndrasDeak I have an answer about that somewhere..
 
8:30 PM
Cabbage.
 
wim
mod = importlib.import_module('1module') should work.
assuming you have 1module.py file findable in sys.path, of course
 
What exactly is the purpose (genuine curiosity)? Similar restrictions applied to a database I used in the past so I prepended all the records with a and then the number , but it was a hack and probably ended up being an XY problem
 
wim
purpose of what?
 
@AndrasDeak "Tavern on the Meta" is gone with the wind :(
 
Having a module starting with a numerical character in the name
 
wim
8:32 PM
consistency of a group of module names with some external data source which you don't have control over
 
@wim thanks, will try
 
Why does it have to warp the naming conventions? read_1234, write_1234 would still be grouped? And still orderable if you keep the rest of the name consistent
 
wim
@AndrasDeak and here is the answer
 
@AndrasDeak Forgive me for my noobness - thanks!
 
8:35 PM
@wim perfect, thanks
@bsam no problem
@roganjosh I have a thing that does things in 3d and I've been calling it 3d<thing> for more than a year and I'd hate to rename it. I usually don't import it so some hacks when I actually do should be OK
 
Is anybody here familiar with module docx?
 
It makes sense now. @wim's answer covers my doubt too. It's just one of those "do it if you must" scenarios :)
@BlackThunder I've used it once. I remember its name, that's better than most people I meet in a pub at weekend. What's your issue?
 
I want to align add_run to center.
 
i wish we had pubs where I live....
 
But it align the whole paragraph in the center.
 
8:43 PM
@roganjosh best I could do...
 
@piRSquared gonna take some time to digest your answer. Am I right in thinking, then, that there's something wrong with the method?
Parsing JSON is **** easy, I don't understand what's going on with their argument parsing
 
I think it might be broken when record_path is None
 
@wim thanks, works like a charm
 
@piRSquared Thanks for your effort on that. I think the bottom example of the docs should be scrapped. It wasn't in the older versions. I think someone has exploited a niche; it's not broadly applicable. As I said to DSM earlier tonight, people seem to be answering json_normalize questions with different approaches
 
Earning rep to give away with bounties is such a chore
 
8:59 PM
@roganjosh it works and is applicable in all scenarios like data = [{'k1': [1, 2], 'k2': {'sk1': 1}}, {'k1': [1, 2], 'k2': {'sk1': 1}}]
your record_path would be k1 and meta would be [['k2', 'sk1']]
It then repeats the stuff in the meta paths for every element of the list-like thing in the record_path.
 
result = json_normalize(data, 'counties', ['state', 'shortname',
...                                           ['info', 'governor']])
 
The problem was that there was no appropriate key to use as the record_path.
 
Why should info be in a sublist in this case?
It's on the same JSON level
 
because the info key points to a sub dictionary
and the second element `governor' is the key to that sub-dict
the resulting column name is 'info.governor'
 
result = json_normalize(data, 'counties', ['state', info',
...                                           ['shortname', 'governor']])
wouldn't that make more sense?
 
9:03 PM
no, because I don't know that 'shortname' or 'governor' are subkeys to the dictionary referred to by info
 
Because they're also using sublists to indicate an extra layer of depth into the JSON
But there's no way to know whether a sublist means you should go one layer deeper or whether it's a value stored against the key
 
those elements of the meta argument ['state', info', ['shortname', 'governor']] the first or only elements refer to dictionary keys at that first level of depth
 
... That's what I wrote
 
so ['state', 'info', 'shortname'] are all keys at the first level of depth
woops
 
LOL
 
9:06 PM
I meant to use the other meta
 
But you justified my own comment with how it works in my head :)
 
There should be an assumption that if record_path isn't passed, it just does the obvious with the meta info. But it doesn't )-:
 
That method needs some serious rethought
 
I'm sure Jeff would agree with you.
 
JSON is trivial to parse to heavily nested levels
I'll have a think about it
I can imagine pitfalls in Pandas with JSON in general, but the syntax is wonky on that one
 
9:15 PM
generally, if each record is just nested dicts then json_normalize already does the right thing
the only ambiguity is when one of the records' keys points to more records
then you have to take a product
 
I assume the example is to get rid of key.key.value_name
And just leave value_name
 
But it doesn't
 
No, it doesn't
 
you still have info.governor
 
So what exactly is the bottom example doing in the docs?
 
9:18 PM
there are two records. In the first record, counties points to 3 more records
 
wim
youtu.be/3K0yGMxraAk?t=10m15s @MartijnPieters I don't understand what you mean here
 
in the second record, counties points to 2 more records
 
wim
mock instances are truthy by default, right?
 
I mean the nested lists as arguments
I think we'll go round in circles for now :/
 
record_path points to counties identifying it as a field that it will iterate over and joining that with the repeated key/values from stuff in meta
 
9:25 PM
hmmm ... ununderstandable is apparently a word
Sounds like some transient molecule being fired out of a nuclear reactor. No... it's English
rbrb
@piRSquared Thanks again for squashing a niggle in my brain :)
 
 
2 hours later…
11:44 PM
stackoverflow.com/q/52395893/1222951 typo (OP admitted to misspelling the parameters)
 

« first day (2894 days earlier)      last day (2053 days later) »