Skip to content

Instantly share code, notes, and snippets.

View oserttas-math's full-sized avatar
🏠
Working from home

ozkan serttas oserttas-math

🏠
Working from home
View GitHub Profile
@oserttas-math
oserttas-math / useful_pandas_snippets.py
Created December 16, 2017 03:20 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# List unique values in a DataFrame column
# h/t @makmanalp for the updated syntax!
df['Column Name'].unique()
# Convert Series datatype to numeric (will error if column has non-numeric values)
# h/t @makmanalp
pd.to_numeric(df['Column Name'])
# Convert Series datatype to numeric, changing non-numeric values to NaN
# h/t @makmanalp for the updated syntax!
@fchollet
fchollet / classifier_from_little_data_script_1.py
Last active July 27, 2024 19:40
Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@jrosebr1
jrosebr1 / paths.py
Last active March 5, 2019 19:50
Image path generator for Python
# Author: Adrian Rosebrock
# Website: www.pyimagesearch.com
# import the necessary packages
import os
def list_images(basePath, contains=None):
# return the set of files that are valid
return list_files(basePath, validExts=(".jpg", ".jpeg", ".png"), contains=contains)
@bsweger
bsweger / useful_pandas_snippets.md
Last active November 13, 2024 19:55
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@sloria
sloria / bobp-python.md
Last active November 14, 2024 15:01
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens