• Skip to secondary menu
  • Skip to main content
  • Skip to primary sidebar

Python and R Tips

Learn Data Science with Python and R

  • Home
  • Python
  • Pandas
    • Pandas 101
  • tidyverse
    • tidyverse 101
  • R
  • Linux
  • Conferences
  • Python Books
  • About
    • Privacy Policy
You are here: Home / Archives for Python / Python Tips

Python Tips

How to Get Unique Values from a Column in Pandas Data Frame?

January 31, 2018 by cmdlinetips

In this tutorial, we will learn how to get unique values of a column in a Pandas dataframe using two approaches. We will first use Pandas unique() function to get unique values of a column and then use Pandas drop_duplicates() function to get unique values of a column. Pandas unique() function To Get Unique values […]

Filed Under: Pandas DataFrame, Python, Python Tips Tagged With: Pandas Data Frame, Pandas drop_duplicates(), Pandas unique(), Python Tips, Unique Values Pandas, uniques values in a column pandas

How To Add a New Column Using a Dictionary in Pandas Data Frame ?

January 28, 2018 by cmdlinetips

Creating a new column to a dataframe is a common task in doing data analysis. And this task often comes in a variety of forms. Earlier we saw how to add a column using an existing columns in two ways. In this post we will learn how to add a new column using a dictionary […]

Filed Under: Pandas DataFrame, Pandas map function, Python Tips Tagged With: Pandas Data Frame, Pandas map function, Python Tips

How to Compute Executing Time in Python?

January 25, 2018 by cmdlinetips

It is really good to know whether the code you wrote is efficient or fast. We can test that by checking how long it takes to execute certain commands, or functions. Computing Execution Time With “time” Module One way to get the execution time is to use the built-in time module and its function time.time. […]

Filed Under: Execution Time, Jupyter %timeit, Python, Python Tips Tagged With: Execution Time in Python, Jupyter %timeit function, Python Tips

5 Examples Using Dict Comprehension in Python

January 23, 2018 by cmdlinetips

List Comprehension is a handy and faster way to create lists in Python in just a single line of code. It helps us write easy to read for loops in a single line. In Python, dictionary is a data structure to store data such that each element of the stored data is associated with a […]

Filed Under: dict comprehension, Dictionary comprehension, Python Tips Tagged With: dict comprehension, Dictionary comprehension, List Comprehension, Python Tips

How to Load a Massive File as small chunks in Pandas?

January 22, 2018 by cmdlinetips

How to load a big csv file in pandas in smaller chunks

The longer you work in data science, the higher the chance that you might have to work with a really big file with thousands or millions of lines. Trying to load all the data at once in memory will not work as you will end up using all of your RAM and crash your computer. […]

Filed Under: Pandas DataFrame, Python, Python Tips, read_csv in Pandas Tagged With: load a big file in chunks, pandas chunksize, Pandas Dataframe, Python Tips

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 15
  • Page 16
  • Page 17
  • Page 18
  • Page 19
  • Page 20
  • Go to Next Page »

Primary Sidebar

Subscribe to Python and R Tips and Learn Data Science

Learn Pandas in Python and Tidyverse in R

Tags

Altair Basic NumPy Book Review Data Science Data Science Books Data Science Resources Data Science Roundup Data Visualization Dimensionality Reduction Dropbox Dropbox Free Space Dropbox Tips Emacs Emacs Tips ggplot2 Linux Commands Linux Tips Mac Os X Tips Maximum Likelihood Estimation in R MLE in R NumPy Pandas Pandas 101 Pandas Dataframe Pandas Data Frame pandas groupby() Pandas select columns Pandas select_dtypes Python Python 3 Python Boxplot Python Tips R rstats R Tips Seaborn Seaborn Boxplot Seaborn Catplot Shell Scripting Sparse Matrix in Python tidy evaluation tidyverse tidyverse 101 Vim Vim Tips

RSS RSS

  • How to convert row names to a column in Pandas
  • How to resize an image with PyTorch
  • Fashion-MNIST data from PyTorch
  • Pandas case_when() with multiple examples
  • An Introduction to Statistical Learning: with Applications in Python Is Here
  • 10 Tips to customize ggplot2 title text
  • 8 Plot types with Matplotlib in Python
  • PCA on S&P 500 Stock Return Data
  • Linear Regression with Matrix Decomposition Methods
  • Numpy’s random choice() function

Copyright © 2025 · Lifestyle Pro on Genesis Framework · WordPress · Log in

Go to mobile version