HOME/Articles/

mysql example Chapter7 10 (snippet)

Article Outline

Python mysql example 'Chapter7 10'

Modules used in program:

  • import numpy as np
  • import pandas as pd

python Chapter7 10

Python mysql example: Chapter7 10

import pandas as pd
import numpy as np

data=pd.DataFrame(np.arange(12).reshape(3,4), index=['Ohio','Colorado','New York'], columns=['one', 'two','three','four'])

print(data)
print('======================================================')
transform= lambda x: x[:4].upper()

data.index=data.index.map(transform)
print(data)