Friday, February 12, 2016

data analysis tools for the Python programming language

Pandas merupakan library untuk mengolah data seperti layaknya SQL, providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language. Berikut beberapa fitur terbaiknya:
  • A fast and efficient DataFrame object for data manipulation with integrated indexing;
  • Tools for reading and writing data between in-memory data structures and different formats: CSV and text files, Microsoft Excel, SQL databases, and the fast HDF5 format;
  • Intelligent data alignment and integrated handling of missing data: gain automatic label-based alignment in computations and easily manipulate messy data into an orderly form;
  • Flexible reshaping and pivoting of data sets;
  • Intelligent label-based slicing, fancy indexing, and subsetting of large data sets;
  • Columns can be inserted and deleted from data structures for size mutability;
  • Aggregating or transforming data with a powerful group by engine allowing split-apply-combine operations on data sets;
  • High performance merging and joining of data sets;
  • Hierarchical axis indexing provides an intuitive way of working with high-dimensional data in a lower-dimensional data structure;
  • Time series-functionality: date range generation and frequency conversion, moving window statistics, moving window linear regressions, date shifting and lagging. Even create domain-specific time offsets and join time series without losing data;
  • Highly optimized for performance, with critical code paths written in Cython or C.
  • Python with pandas is in use in a wide variety of academic and commercial domains, including Finance, Neuroscience, Economics, Statistics, Advertising, Web Analytics, and more.

 Contoh Penggunaan Pandas


import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

nama_file = 'contoh_data2.txt'
df = pd.read_csv(nama_file,delim_whitespace=True)
data_id = pd.Series(df['id']) #biar mudah, ambil column ID
jumlah = data_id.count() #untuk itung jumlah baris
f = data_id.value_counts() #untuk itung jumlah nilainya
d = dict(f); #masukan kedalam dictionary
x = d.keys() 
y = np.array(d.values())
y_pos = np.arange(len(y)),y,align='center', alpha=0.5)
plt.xticks(y_pos, x)
plt.title('jumlah pelanggan '+str(f.count()))


Kamu bisa mempelajari di

No comments:

Post a Comment