跳过导航

US Consumer Price Index

labor statistics cpi

消费者价格指数 (CPI) 是衡量城市消费者为一系列市场消费商品和服务所支付的价格随时间变化的平均值。

原始数据集位置提供了自述文件 ,其中包含介绍此数据集详细信息的文件

此数据集来源于美国劳工统计局 (BLS) 发布的消费者价格指数数据。 要了解与使用此数据集相关的条款和条件,请查看链接与版权信息以及重要网站声明

存储位置

此数据集存储在美国东部 Azure 区域。 建议将计算资源分配到美国东部地区,以实现相关性。

相关数据集

通知

Microsoft 以“原样”为基础提供 AZURE 开放数据集。 Microsoft 对数据集的使用不提供任何担保(明示或暗示)、保证或条件。 在当地法律允许的范围内,Microsoft 对使用数据集而导致的任何损害或损失不承担任何责任,包括直接、必然、特殊、间接、偶发或惩罚。

此数据集是根据 Microsoft 接收源数据的原始条款提供的。 数据集可能包含来自 Microsoft 的数据。

Access

Available inWhen to use
Azure Notebooks

Quickly explore the dataset with Jupyter notebooks hosted on Azure or your local machine.

Azure Databricks

Use this when you need the scale of an Azure managed Spark cluster to process the dataset.

Azure Synapse

Use this when you need the scale of an Azure managed Spark cluster to process the dataset.

Preview

area_code item_code series_id year period value footnote_codes seasonal periodicity_code series_title item_name area_name
S49E SEHF01 CUURS49ESEHF01 2017 M12 279.974 nan U R Electricity in San Diego-Carlsbad, CA, all urban consumers, not seasonally adjusted Electricity San Diego-Carlsbad, CA
S49E SEHF01 CUURS49ESEHF01 2017 M12 279.974 nan U R Electricity in San Diego-Carlsbad, CA, all urban consumers, not seasonally adjusted Electricity San Diego-Carlsbad, CA
S49E SEHF01 CUURS49ESEHF01 2017 M12 279.974 nan U R Electricity in San Diego-Carlsbad, CA, all urban consumers, not seasonally adjusted Electricity San Diego-Carlsbad, CA
S49E SEHF01 CUURS49ESEHF01 2017 M12 279.974 nan U R Electricity in San Diego-Carlsbad, CA, all urban consumers, not seasonally adjusted Electricity San Diego-Carlsbad, CA
S49E SEHF01 CUURS49ESEHF01 2017 M12 279.974 nan U R Electricity in San Diego-Carlsbad, CA, all urban consumers, not seasonally adjusted Electricity San Diego-Carlsbad, CA
S49E SEHF01 CUURS49ESEHF01 2017 M12 279.974 nan U R Electricity in San Diego-Carlsbad, CA, all urban consumers, not seasonally adjusted Electricity San Diego-Carlsbad, CA
S49E SEHF01 CUURS49ESEHF01 2018 M01 284.456 nan U R Electricity in San Diego-Carlsbad, CA, all urban consumers, not seasonally adjusted Electricity San Diego-Carlsbad, CA
S49E SEHF01 CUURS49ESEHF01 2018 M01 284.456 nan U R Electricity in San Diego-Carlsbad, CA, all urban consumers, not seasonally adjusted Electricity San Diego-Carlsbad, CA
S49E SEHF01 CUURS49ESEHF01 2018 M01 284.456 nan U R Electricity in San Diego-Carlsbad, CA, all urban consumers, not seasonally adjusted Electricity San Diego-Carlsbad, CA
S49E SEHF01 CUURS49ESEHF01 2018 M01 284.456 nan U R Electricity in San Diego-Carlsbad, CA, all urban consumers, not seasonally adjusted Electricity San Diego-Carlsbad, CA
Name Data type Unique Values (sample) Description
area_code string 70 0000
0300

用于标识特定地理区域的唯一代码。 有关完整的区域代码,请参阅 http://download.bls.gov/pub/time.series/cu/cu.area

area_name string 69 U.S. city average
South

特定地理区域的名称。 有关所有区域名称和代码,请参阅 https://download.bls.gov/pub/time.series/cu/cu.area

footnote_codes string 3 nan
U

标识数据系列的脚注。 大多数值都为 NULL。

item_code string 515 SA0E
SAF11

确定数据观测相关的项目。 有关所有项目名称和代码,请参阅 https://download.bls.gov/pub/time.series/cu/cu.item

item_name string 515 Energy
Food at home

商品全称。 有关项目名称和代码,请参阅 https://download.bls.gov/pub/time.series/cu/cu.txt

period string 16 S01
S02

标识观测数据的周期。 格式:M01-M13 或 S01-S03(M = 月,M13 = 年度平均,S =半年)。 例如:M06 = 6 月。 有关周期名称和代码,请参阅 https://download.bls.gov/pub/time.series/cu/cu.period

periodicity_code string 3 R
S

数据观察的频率。 S = 半年;R = 定期。

seasonal string 1,043 U
S

标识数据是否经过季节性调整的代码。 S = 季节性调整;U = 未经调整。

series_id string 16,683 CWUR0300SAF1
CWUR0100SAF11

标识特定系列的代码。 时序是指在较长时间内以一致的时间间隔(例如,月、季度、半年、年)观测到的一组数据。 BLS 时序数据通常以月为时间间隔生成,其数据范围从特定地理区域的特定使用者项目(其价格按月收集)到特定行业的工人类别(其就业率按月记录)等等。有关详细信息,请参阅 https://download.bls.gov/pub/time.series/cu/cu.txt

series_title string 8,336 Food and beverages in Los Angeles-Long Beach-Anaheim, CA, all urban consumers, not seasonally adjusted
New vehicles in Midwest urban, urban wage earners and clerical workers, not seasonally adjusted

相应 series_id 的系列名称。 有关时序 ID 和名称,请参阅 https://download.bls.gov/pub/time.series/cu/cu.series

value float 310,603 100.0
101.0999984741211

商品的价格指数。

year int 25 2018
2017

标识观测年份。

Select your preferred service:

Azure Notebooks

Azure Databricks

Azure Synapse

Azure Notebooks

Package: Language: Python Python
In [2]:
# This is a package in preview.
from azureml.opendatasets import UsLaborCPI

usLaborCPI = UsLaborCPI()
usLaborCPI_df = usLaborCPI.to_pandas_dataframe()
ActivityStarted, to_pandas_dataframe
ActivityStarted, to_pandas_dataframe_in_worker
Looking for parquet files...
Reading them into Pandas dataframe...
Reading cpi/part-00000-tid-8289857611821412231-4ef1bca9-6386-4e12-8c7a-31d3ff5d4bc7-3154-1-c000.snappy.parquet under container laborstatisticscontainer
Done.
ActivityCompleted: Activity=to_pandas_dataframe_in_worker, HowEnded=Success, Duration=29342.59 [ms]
ActivityCompleted: Activity=to_pandas_dataframe, HowEnded=Success, Duration=29374.5 [ms]
In [3]:
usLaborCPI_df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 11624937 entries, 0 to 11624936
Data columns (total 12 columns):
area_code           object
item_code           object
series_id           object
year                int32
period              object
value               float32
footnote_codes      object
seasonal            object
periodicity_code    object
series_title        object
item_name           object
area_name           object
dtypes: float32(1), int32(1), object(10)
memory usage: 975.6+ MB
In [1]:
# Pip install packages
import os, sys

!{sys.executable} -m pip install azure-storage-blob
!{sys.executable} -m pip install pyarrow
!{sys.executable} -m pip install pandas
In [2]:
# Azure storage access info
azure_storage_account_name = "azureopendatastorage"
azure_storage_sas_token = r""
container_name = "laborstatisticscontainer"
folder_name = "cpi/"
In [3]:
from azure.storage.blob import BlockBlobServicefrom azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient

if azure_storage_account_name is None or azure_storage_sas_token is None:
    raise Exception(
        "Provide your specific name and key for your Azure Storage account--see the Prerequisites section earlier.")

print('Looking for the first parquet under the folder ' +
      folder_name + ' in container "' + container_name + '"...')
container_url = f"https://{azure_storage_account_name}.blob.core.windows.net/"
blob_service_client = BlobServiceClient(
    container_url, azure_storage_sas_token if azure_storage_sas_token else None)

container_client = blob_service_client.get_container_client(container_name)
blobs = container_client.list_blobs(folder_name)
sorted_blobs = sorted(list(blobs), key=lambda e: e.name, reverse=True)
targetBlobName = ''
for blob in sorted_blobs:
    if blob.name.startswith(folder_name) and blob.name.endswith('.parquet'):
        targetBlobName = blob.name
        break

print('Target blob to download: ' + targetBlobName)
_, filename = os.path.split(targetBlobName)
blob_client = container_client.get_blob_client(targetBlobName)
with open(filename, 'wb') as local_file:
    blob_client.download_blob().download_to_stream(local_file)
In [4]:
# Read the parquet file into Pandas data frame
import pandas as pd

print('Reading the parquet file into Pandas data frame')
df = pd.read_parquet(filename)
In [5]:
# you can add your filter at below
print('Loaded as a Pandas data frame: ')
df
In [6]:
 

Azure Databricks

Package: Language: Python Python
In [1]:
# This is a package in preview.
from azureml.opendatasets import UsLaborCPI

usLaborCPI = UsLaborCPI()
usLaborCPI_df = usLaborCPI.to_spark_dataframe()
ActivityStarted, to_spark_dataframe ActivityStarted, to_spark_dataframe_in_worker ActivityCompleted: Activity=to_spark_dataframe_in_worker, HowEnded=Success, Duration=3007.07 [ms] ActivityCompleted: Activity=to_spark_dataframe, HowEnded=Success, Duration=3011.43 [ms]
In [2]:
display(usLaborCPI_df.limit(5))
area_codeitem_codeseries_idyearperiodvaluefootnote_codesseasonalperiodicity_codeseries_titleitem_namearea_name
S49ESEHF01CWURS49ESEHF01 2017M12279.976nanURElectricity in San Diego-Carlsbad, CA, urban wage earners and clerical workers, not seasonally adjustedElectricitySan Diego-Carlsbad, CA
S49ESEHF01CWURS49ESEHF01 2017M12279.976nanURElectricity in San Diego-Carlsbad, CA, urban wage earners and clerical workers, not seasonally adjustedElectricitySan Diego-Carlsbad, CA
S49ESEHF01CWURS49ESEHF01 2017M12279.976nanURElectricity in San Diego-Carlsbad, CA, urban wage earners and clerical workers, not seasonally adjustedElectricitySan Diego-Carlsbad, CA
S49ESEHF01CWURS49ESEHF01 2017M12279.976nanURElectricity in San Diego-Carlsbad, CA, urban wage earners and clerical workers, not seasonally adjustedElectricitySan Diego-Carlsbad, CA
S49ESEHF01CWURS49ESEHF01 2017M12279.976nanURElectricity in San Diego-Carlsbad, CA, urban wage earners and clerical workers, not seasonally adjustedElectricitySan Diego-Carlsbad, CA
In [1]:
# Azure storage access info
blob_account_name = "azureopendatastorage"
blob_container_name = "laborstatisticscontainer"
blob_relative_path = "cpi/"
blob_sas_token = r""
In [2]:
# Allow SPARK to read from Blob remotely
wasbs_path = 'wasbs://%s@%s.blob.core.windows.net/%s' % (blob_container_name, blob_account_name, blob_relative_path)
spark.conf.set(
  'fs.azure.sas.%s.%s.blob.core.windows.net' % (blob_container_name, blob_account_name),
  blob_sas_token)
print('Remote blob path: ' + wasbs_path)
In [3]:
# SPARK read parquet, note that it won't load any data yet by now
df = spark.read.parquet(wasbs_path)
print('Register the DataFrame as a SQL temporary view: source')
df.createOrReplaceTempView('source')
In [4]:
# Display top 10 rows
print('Displaying top 10 rows: ')
display(spark.sql('SELECT * FROM source LIMIT 10'))

Azure Synapse

Package: Language: Python
In [1]:
# Azure storage access info
blob_account_name = "azureopendatastorage"
blob_container_name = "laborstatisticscontainer"
blob_relative_path = "cpi/"
blob_sas_token = r""
In [2]:
# Allow SPARK to read from Blob remotely
wasbs_path = 'wasbs://%s@%s.blob.core.windows.net/%s' % (blob_container_name, blob_account_name, blob_relative_path)
spark.conf.set(
  'fs.azure.sas.%s.%s.blob.core.windows.net' % (blob_container_name, blob_account_name),
  blob_sas_token)
print('Remote blob path: ' + wasbs_path)
In [3]:
# SPARK read parquet, note that it won't load any data yet by now
df = spark.read.parquet(wasbs_path)
print('Register the DataFrame as a SQL temporary view: source')
df.createOrReplaceTempView('source')
In [4]:
# Display top 10 rows
print('Displaying top 10 rows: ')
display(spark.sql('SELECT * FROM source LIMIT 10'))