Python Time Series Forecast – A Guided Example on Bitcoin Price Data

A Time Series is essentially a tabular data with the special feature of having a time index. The common forecast task is ‘knowing the past (and sometimes the present), predict the future’. This task, taken as a principle, reveals itself in several ways: in how to interpret your problem, in feature engineering, and in which … Read more

Python Convert Parquet to CSV

Problem 💬 Challenge: How to convert a Parquet file ‘my_file.parquet’ to a CSV file ‘my_file.csv’ in Python? In case you don’t know what a Parquet file is, here’s the definition: 💡 Info: Apache Parquet is an open-source, column-oriented data file format designed for efficient data storage and retrieval using data compression and encoding schemes to … Read more

Pandas – How to Find DataFrame Row Indices with NaN or Null Values

Problem Formulation and Solution Overview This article will show you how to find DataFrame row indices in Python with NaN or Null (empty) values. To make it more interesting, we have the following scenario: Rivers Clothing has given you a CSV file that requires a clean-up to make it usable for Payroll and Data Analysis. … Read more

How to Apply a Function to Each Cell in a Pandas DataFrame?

Problem Formulation Given the following DataFrame df: 💬 Challenge: How to apply a function f to each cell in the DataFrame? For example, you may want to apply a function that replaces all odd values with the value ‘odd’. Solution: DataFrame applymap() The Pandas DataFrame df.applymap() method returns a new DataFrame where the function f … Read more

Python Convert Fixed Width File to CSV

What is a Fixed-Width File? 💡 Definition: A fixed-width text file contains data that is structured in rows and columns. Each row contains one data entry consisting of multiple values (one value per column). Each column has a fixed width, i.e., the same number of characters, restricting the maximum data size per column. Example of … Read more