Posts

Showing posts with the label Python

Tips To Overcome Over plotting of Dense Scatter Plots.

Image
Here are some tricks to overcome overplotting of dense scatter plots Use a transparency factor: # Matplotlib scatter plot with an alpha value plt . scatter ( df [ X_COL ], df [ Y_COL ], alpha = 0.03 ) plt . xlabel ( X_COL ) plt . ylabel ( Y_COL ) plt . show () This will introduce some transparency to your visual and the less transparency the denser. You can make this even cooler with animated transparency: # Initialize plot and animation camera fig , ( ax1 , ax2 ) = plt . subplots ( 1 , 2 ) # Create 2 camera = Camera ( fig ) # Create a sequence of alpha values alpha_range = np . linspace ( 0.5 , 0 , 30 ) ** 3 # For each alpha value for alpha_value in alpha_range : # Plot "vanilia" plot for reference ax1 . scatter ( df [ X_COL ], df [ Y_COL ], color = 'black' ) # Plot scatter plot with the alpha value ax2 . scatter ( df [ X_COL ], df [ Y_COL ], alpha = alpha_value , color = 'black' ) # Take a ...

Integrating Python in Power BI With An Example Of Data Wrangling & Data Visualization

Image
  With a mix of Power BI & Excel's versatility and coding experience, You can easily wrangle any kind of data and get the most out of it. Let's see how we can use python in two processes (Data Wrangling & Data Visualization) inside Power BI Make sure that anaconda and python3 installed on your pc. Our Data set The dataset I'm using for this article is a Kaggle dataset that I've recently worked on you can check it out here what we are going to do is to transform some of my work in this notebook to power bi. 2. Data wrangling The data wrangling process in power bi is based inside the query editor After loading your data click on the transform tab then run a python script then you will need to import your libraries and run your code for me, the dataset only needed to replace some values and to get the date and time  for more information check out my Kaggle notebook You will get this after running your code this is the new dataset after running your code  so all you...

Jupyter Notebook’s Making Slides And Hide Code Cells

Image
  Create slideshows from notebooks is one of my favorite features. You can see  an example of a slideshow here  introducing pandas for working with data. The slides are created in notebooks like normal, but you’ll need to designate which cells are slides and the type of slide the cell will be. In the menu bar, click View > Cell Toolbar > Slideshow to bring up the slide cell menu on each cell. Turning on Slideshow toolbars for cells will show a menu dropdown on each cell that lets you choose how the cell shows up in the slideshow. Turning on Slideshow toolbars for cells, This will show a menu choose slide type, Slides are full slides that you move through left to right. Sub-slides show up in the slideshow by pressing up or down. Fragments are hidden at first, then appear with a button press. You can skip cells in the slideshow with Skip and Notes leaves the cell as speaker notes. the dropdown on each cell that lets you choose how the cell shows up in the slideshow. T...