Changing aspect on Jupyter Notebook - python

So I've just start playing with dataframes and the first problem I encounter was this.
In the tutorial (this is not a single example) after doing the df.head command, the data frame showed like in the left side of the picture. On the right side is my result doing the same outputs, the only difference is the tutorial is doing on windows computer, and I am doing on a Mac.
Can somebody guide me how to make the aspect of dataframe to be more understandable and easier to work with?
L.E:Actually I can't post the picture, but is there any command that I can use to put the data frame in a table, to be more readable.

Related

How to center a dataframe in streamlit new version

I had no problem with the alignment in the old version but when I upgraded to the new version I saw this happen. I tried the following 3 different approach below the dataframe but none of them fixes the problem. Is there any way to work around it?
#Sets df size with width 1000 and height 300, but width has a limited range
st.dataframe(df, 1000, 300)
st.dataframe(df, use_container_width=True)
st.write(df, use_container_width=True)
I ask this question for a while now but yet didn't get any response until I figured a way to handle my problem.
I used streamlit AgGrid Component to fix my problem. AgGrid() by default will center the dataframe, it also has other awesome features of handling data frames much better than st.dataframe() and it is pretty simple and clean. I could even choose to color the data frame to my liking which I found pretty cool and interactive.
In case you face similar problem and want to take this approach I will recommend you visit streamlit AgGrid Component to know the inside of the component and how it is implimented.
from st_aggrid import AgGrid
AgGrid(df)
OUTPUT:

Hosting interactive matplotlib plots online

I've built a simple program using matplotlib widgets to label a series of images for a classification task (see image below). My script adds the label and filename to a pandas dataframe depending on the button chosen in the window and moves on to the next image. When finished saves the whole dataframe to a csv.
Example Labelling Interface
I chose to build it rather than use something already out there as most programs seemed too complicated for the type of problem I have and I was hoping for a quick labelling solution - here it's just a simple click of a button and it's on to the next image.
My initial plan was to have a labelling program which I can host somewhere (something like AWS or Azure) in an app where others could simply go to a link and help with classifying some images, however I've found it hard to find anything on this.
I'm looking for general advice on if
a) hosting mpl interactive plots online is possible (if so any information would be greatly appreciated)
b) there's a simpler way to package this together to distribute to others without hosting online
c) there's a much better solution which I've somehow missed
Thanks in advance for any help!

Mark an area within a plot in Jupyter Notebook and extract the data/ brushing

We are using Jupyter Notebooks and would like to make our graphical data analysis more interactive: we would like to select an area
in a plot and be able to easly access/ extract the data. We saw that you can do such things with e.g. bokeh. However, we are searching for something "simpler", just a few python code lines any scripting beginners can grasp easily.
We feel that others probably solved this issue many times and we just don't know the right buzz words for searching.
Can you help us searching?
Again, marking and data extracting is the main goal. Additional stretch goals would be:
If you mark some data in one plot, they should also marked in all other plots.
We could use seaborn for plotting.
Thank you in advance and best regards.

How to create a very specific data diagram using Python

I would like to make a diagram in Python similar to the one shown below. From what I've seen so far, there is no a library that I could use directly. Can you suggest me where to start from, for example, would it be worth to improvise by stacking horizontally multiple subplots. Is there maybe a better approach?
Thanks!
I believe the name you're looking for is Parallel Coordinates Plot.
I'm sure Plotly supports it and there are tutorials online for other libraries as well.
Let me know if this helps.
Edit: and judging by this image from Plotly's docs your example image comes from there.

How do I extract the GUI plotting part of this existing FOSS app (itrade)

I have recently downloaded itrade, and so far I have been unable to get it to run (dependency on wxaddons amongst other things). Also, the project seems to have been disbanded since 2008.
Last but not the least, the project contains a lot of functionality which I just don't need.
All I require is the functionality to produce a graph similar to that shown on the Journalier tab in the image below; and to be honest, I don't even need all of the additional indicators shown in the image. I will be happy enough with the (1st) top chart and the (2nd) midle sub chart, without all the indicators.
I have had a look at the code, and since I am not familiar with wxPython etc, I am finding it difficult to locate the code that is responsible for producing the image below.
I'd be grateful if anyone with either wxPython or itrade experience could outline the steps needed (or explicitly state how) to extract only the section of the code that produces the image below. The objective being that I can read in data from a CSV file, and pass it to the new script, to display a GUI plot similar to the one shown below.
If you really have to do this, this would be my approach:
Find the code that produces these tabs
Find the code that produces the visual graph for the Journalier tab
Find the code where the data is produced that is displayed in the graph
Find the code that passes the data to the graph and how it is processed before being displayed
Extract the necessary pieces of logic to produce and process the data
Use a plotting library to create the graph; it's easier to hook a plotting library into your application than to try and integrate this particular piece of visual code. Especially if you don't need most of the visual indicators.

Categories

Resources