antoinecarme / pyaf

PyAF is an Open Source Python library for Automatic Time Series Forecasting built on top of popular pydata modules.
BSD 3-Clause "New" or "Revised" License
459 stars 72 forks source link

Double check unicode support #76

Closed antoinecarme closed 6 years ago

antoinecarme commented 6 years ago

Need tol check that PyAF handles unicode properly:

  1. In the log messages
  2. in pandas frames when reading, manipulating and writing to csv
  3. in the plots
  4. in the json outputs
  5. in the options / api
  6. in the web services etc ...
antoinecarme commented 6 years ago

Ozone dataset with variables in chinese (google translation ...):

import pandas as pd
import numpy as np

import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds

b1 = tsds.load_ozone()
df = b1.mPastData

lTimeVar = u"月"
lSignalVar = u"臭氧"
df[lSignalVar] = df[b1.mSignalVar]
df[lTimeVar] = df[b1.mTimeVar]

lEngine = autof.cForecastEngine()
lEngine

H = b1.mHorizon;
lEngine.train(df , lTimeVar , lSignalVar, H);
lEngine.getModelInfo();
print(lEngine.mSignalDecomposition.mTrPerfDetails.head());

lEngine.mSignalDecomposition.mBestModel.mTimeInfo.mResolution

lEngine.standardPlots("outputs/my_ozone");

dfapp_in = df.copy();
dfapp_in.tail()

dfapp_out = lEngine.forecast(dfapp_in, H);
#dfapp_out.to_csv("outputs/ozone_apply_out.csv")
dfapp_out.tail(2 * H)
print("Forecast Columns " , dfapp_out.columns);
Forecast_DF = dfapp_out[[lTimeVar , lSignalVar, lSignalVar + '_Forecast']]
print(Forecast_DF.info())
print("Forecasts\n" , Forecast_DF.tail(H));

print("\n\n<ModelInfo>")
print(lEngine.to_json());
print("</ModelInfo>\n\n")
print("\n\n<Forecast>")
print(Forecast_DF.tail(2*H).to_json(date_format='iso'))
print("</Forecast>\n\n")
antoinecarme commented 6 years ago

Added a jupyter notebook.

For the moment, the following points are OK :

  1. In the log messages
  2. in pandas frames when reading, manipulating and writing to csv
  3. in the json outputs
antoinecarme commented 6 years ago

Need to create a separate bug report for matplotlib and unicode and close this one.