|
CarForumPoster posted:I just started yesterday so right now I nab everything and dump it into a CSV. Though I'm not sure what you actually want. (Supervised) machine learning relates standardised data of one form (predictors) to standardised data of another form (outcomes). It seems to me you're describing a part of the data wrangling process still - although that too might belong into the data science thread.
|
# ¿ Oct 6, 2017 18:16 |
|
|
# ¿ May 17, 2024 06:17 |
|
Danyull I'm not perfectly sure I get what you want, butcode:
|
# ¿ Nov 29, 2017 10:34 |
|
Danyull posted:You're right, I should have used the length there instead of one, however the infinite loop problem still existed. I ended up fixing it actually, but I still don't know how. For some reason when it got to the point of creating a new chunk, the new chunk.ch would already be filled with the elements of pix. Appending the elements of pix onto the end of chunk.ch was for some reason also appending the elements onto pix again, causing it to double in size each time. The issue went away after adding in "chunk.ch = []" between "chunk = Chunk()" and the appending loop. code:
|
# ¿ Nov 29, 2017 20:49 |
|
"while" solutions usually feel rather un-pythonic to me. I think if you want to iterate over an iterable, you should iterate over the iterable! Counting indices (or however that thing is called) are alien and un-pthonic.
|
# ¿ Nov 29, 2017 22:13 |
|
I found this very interesting: https://medium.com/dunder-data/python-for-data-analysis-a-critical-line-by-line-review-5d5678a4c203 A brutal review of Wes McKinney's book on pandas.
|
# ¿ Dec 6, 2017 12:35 |
|
Dominoes posted:Is this summary of Pandas accurate? It's how I look at it/assess when to use it: Or, for people who know R: "Dataframes for Python."
|
# ¿ Dec 6, 2017 19:03 |
|
So in light of Cingulate posted:I found this very interesting: https://medium.com/dunder-data/python-for-data-analysis-a-critical-line-by-line-review-5d5678a4c203
|
# ¿ Dec 14, 2017 12:33 |
|
QuarkJets posted:If you have actual C-style functions dealing with regular old primitive types (float, int, etc) you can just compile a shared library and load it with ctypes.
|
# ¿ Dec 27, 2017 14:08 |
|
If you expect to do more data analysis with Python in the future, the recommendation is probably to just learn pandas right now.
|
# ¿ Jan 8, 2018 20:38 |
|
Seventh Arrow posted:each line needs to take the value from the next row in the spreadsheet.
|
# ¿ Jan 10, 2018 13:23 |
|
Seventh Arrow posted:What I'm trying to say is that each folium line can't keep reading the first row over and over again. The first folium line needs to use row 1, the second one needs to use row 2, and so on. code:
Sorry if I'm totally missing your point.
|
# ¿ Jan 10, 2018 15:50 |
|
vikingstrike posted:If you need to pull the value of the next row into the current row, then create a new column with shift(-1)? code:
Jose Cuervo posted:If your dataframe has 'Lat', 'Long' and 'Description' columns, then I think this is what you might be looking for: Python code:
|
# ¿ Jan 10, 2018 16:01 |
|
Seventh Arrow posted:Sorry for the confusion. Maybe I can make it clearer: I need these lines "folium.Marker([x, y]..." populating the python script so they can put markers on the folium map. Except there's thousands of rows in the latitude/longitude csv, so I'm not going to write each folium line by hand. Python code:
(Can't vectorise if folium.Marker doesn't take array input.) Seventh Arrow, what's throwing me off is you keep writing you want to "generate lines". But what you do want is to have Python go through the data and use the values, not literally create these lines of code, right?
|
# ¿ Jan 10, 2018 18:13 |
|
Seventh Arrow posted:Yes, I think so. Maybe a better way to put it is that I want folium to put a marker on the map for every lat/long coordinate in the csv. Whatever python voodoo it takes to do that is irrelevant to me (unless it actually involves sacrificing chickens on an altar). I hope it's halfway intuitive what's going on - the code:
code:
|
# ¿ Jan 10, 2018 18:38 |
|
Seventh Arrow posted:Ok, thank you. What happened to the "shift(-1)"? Is that no longer necessary?
|
# ¿ Jan 10, 2018 19:16 |
|
Jose Cuervo posted:I don't know that the code you have works. Running the following (I think equivalent) code results in 'ValueError: need more than 1 value to unpack' Python code:
code:
|
# ¿ Jan 10, 2018 19:18 |
|
QuarkJets posted:There are lots of options but I've always found multiprocessing the easiest to use and most widely applicable. If you have no idea what to use and don't want to explain the problem further then maybe give that a shot
|
# ¿ Jan 13, 2018 10:54 |
|
wasey posted:How do I assign each line element to an object in Python
|
# ¿ Feb 3, 2018 19:03 |
|
wasey posted:I'm the dumb one here, trying to learn Python on the fly for a class and it has been rough. I'm not sure that I want to do that, I just want to make sure that an activity's start and end time are not separated after I sort them by start time. I'm able to put the number of elements in a set in one list(11, 3) and the elements themselves into another list, but I don't know how to proceed from there Once you have the data in either format, the sorting will be absolutely trivial (literally df.sort()), but it would be a bit more complicated to get the data in there due to the lone "3" in the 4th to last line. So really, it depends a bit on what exactly you want to do.
|
# ¿ Feb 3, 2018 19:38 |
|
In this case,code:
|
# ¿ Feb 10, 2018 10:05 |
|
Slimchandi posted:For clarity, I was referring to functions with side effects or return None rather than just callables. The given example was exactly what I intended. Remember, it violates PEP8, but you can even do [code]for counter in iterable: function_with_side_effects()[/cod] Without the line break.
|
# ¿ Feb 10, 2018 20:07 |
|
I was a bit surprisedcode:
|
# ¿ Feb 10, 2018 20:26 |
|
Dr Subterfuge posted:map sounds like what you're talking about? baka kaba posted:consume(map(print, name)). Buuuut why not just code:
|
# ¿ Feb 10, 2018 21:35 |
|
sofokles posted:Thats what im after
|
# ¿ Feb 13, 2018 20:59 |
|
Boris Galerkin posted:I want to make multiple plots so that I can save and style them indivudually, and then I wanna be able to pass them into one master plot where I’d arrange them into some logical order, and then save that final one too. How would I do that? code:
|
# ¿ Feb 21, 2018 14:26 |
|
You can try this stackexchange answer: https://stackoverflow.com/questions/6309472/matplotlib-can-i-create-axessubplot-objects-then-add-them-to-a-figure-instance/46906599#46906599 But my suggestion would be to write a function that creates your axis, and give it an axis parameter. Then you call it once for its own figure, and another time for the joint figure. Much less awkward.
|
# ¿ Feb 21, 2018 20:57 |
|
Generally, if you want to do something in Python and it’s awkward, more often than not you want to do the wrong thing. Just try it with a function, like I said. Everyone and their moms uses notebooks. When I want to multiply two numbers and one of them has more than 3 digits, I open a notebook. That is, if you analyse data.
|
# ¿ Feb 22, 2018 18:12 |
|
The basic math thing was hyperbole. Well, what is it that you need to do? Complex plotting things, with multiple open figures, a re a great scenario for notebooks. If you frequently get back to the data itself, even better. In other contexts, other tools will be superior. It depends.
|
# ¿ Feb 22, 2018 18:30 |
|
Can you show what the file looks like? I am pretty optimistic this can be solved with 3 lines of pandas.
|
# ¿ Feb 27, 2018 19:30 |
|
I'm trying to look up what a movie professionals primary occupation is.Python code:
It's not too slow, but could it go faster? Edit: obvious suggestion would be kicking out all the porn movies. edit 2: Oh wow, I switched to df.groupby and now it's much faster. Cingulate fucked around with this message at 20:37 on Feb 28, 2018 |
# ¿ Feb 28, 2018 20:05 |
|
Sad Panda posted:Next part of my Blackjack program. A lookup table. A short extract of the data would be...
|
# ¿ Mar 6, 2018 00:00 |
|
I think that function is overkill. Either that, or it's a bit inefficient to always read in the csv whenever you want to retrieve one single number. You could also write an input check that gracefully fails whenever you request a combination that doesn't exist. In the long run, you probably want to construct a class (to handle state), and that class could store the df, and that function could be a method.
|
# ¿ Mar 6, 2018 18:54 |
|
Sad Panda posted:You're right about the reading of the CSV. I've moved that outside of the function so it should just happen at load when the df object is created and then stay loaded in cache right? Though as I said, you will probably end up using a class or two.
|
# ¿ Mar 6, 2018 19:06 |
|
You mean like this?code:
|
# ¿ Mar 18, 2018 10:46 |
|
... there is a non-dark theme in pycharm?
|
# ¿ Mar 19, 2018 18:52 |
|
Dr Subterfuge posted:Instead of X it would probably be easier to use pandas
|
# ¿ Apr 1, 2018 18:06 |
|
edit: I am incredibly stupid
Cingulate fucked around with this message at 07:00 on Apr 12, 2018 |
# ¿ Apr 11, 2018 22:42 |
|
I'm setting up a static website, hopefully so it's community editable. So I'm thinking markdown and GitHub. I only really know Python, so I went for Pelican, but now I'm wondering if I shouldn't just suck it up and use Jekyll. Thoughts from the more experienced people ITT?
|
# ¿ May 16, 2018 18:05 |
|
Thermopyle posted:Are you sure you want something like that instead of a wiki? A wiki is the first thing I thought of when you said "community editable". Also I want to force feed GitHub and markdown down their throats anyways
|
# ¿ May 16, 2018 18:32 |
|
|
# ¿ May 17, 2024 06:17 |
|
bamhand posted:I think it's a dataframe? I'm modifying some old code where I'm just changing the source of the data but trying to keep the plots the same. This is what was working before (also I'm pretty new to python in general): axes = pt.axes() df_1.plot(..., ax=ax) df_2.plot(..., ax=ax) and both calls will show up in the same axes. Better: use seaborn instead. If you want to plot predicted vs. actual, consider using seaborn.jointplot.
|
# ¿ May 24, 2018 17:13 |