首页 文章 精选 留言 我的

精选列表

搜索[快速],共10000篇文章
优秀的个人博客,低调大师

[雪峰磁针石博客]数据分析工具pandas快速入门教程2-pandas数据结构

创建数据 Series和python的列表类似。DataFrame则类似值为Series的字典。 create.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # create.py import pandas as pd print("\n\n创建序列Series") s = pd.Series(['banana', 42]) print(s) print("\n\n指定索引index创建序列Series") s = pd.Series(['Wes McKinney', 'Creator of Pandas'], index=['Person', 'Who']) print(s) # 注意:列名未必为执行的顺序,通常为按字母排序 print("\n\n创建数据帧DataFrame") scientists = pd.DataFrame({ ' Name': ['Rosaline Franklin', 'William Gosset'], ' Occupation': ['Chemist', 'Statistician'], ' Born': ['1920-07-25', '1876-06-13'], ' Died': ['1958-04-16', '1937-10-16'], ' Age': [37, 61]}) print(scientists) print("\n\n指定顺序(index和columns)创建数据帧DataFrame") scientists = pd.DataFrame( data={'Occupation': ['Chemist', 'Statistician'], 'Born': ['1920-07-25', '1876-06-13'], 'Died': ['1958-04-16', '1937-10-16'], 'Age': [37, 61]}, index=['Rosaline Franklin', 'William Gosset'], columns=['Occupation', 'Born', 'Died', 'Age']) print(scientists) 执行结果: $ ./create.py 创建序列Series 0 banana 1 42 dtype: object 指定索引index创建序列Series Person Wes McKinney Who Creator of Pandas dtype: object 创建数据帧DataFrame Name Occupation Born Died Age 0 Rosaline Franklin Chemist 1920-07-25 1958-04-16 37 1 William Gosset Statistician 1876-06-13 1937-10-16 61 指定顺序(index和columns)创建数据帧DataFrame Occupation Born Died Age Rosaline Franklin Chemist 1920-07-25 1958-04-16 37 William Gosset Statistician 1876-06-13 1937-10-16 61 Series 官方文档:http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.html Series的属性 属性 描述 loc 使用索引值获取子集 iloc 使用索引位置获取子集 dtype或dtypes 类型 T 转置 shape 数据的尺寸 size 元素的数量 values ndarray或类似ndarray的Series Series的方法 方法 描述 append 连接2个或更多系列 corr 计算与其他Series的关联 cov 与其他Series计算协方差 describe 计算汇总统计 drop duplicates 返回一个没有重复项的Series equals Series是否具有相同的元素 get values 获取Series的值,与values属性相同 hist 绘制直方图 min 返回最小值 max 返回最大值 mean 返回算术平均值 median 返回中位数 mode(s) 返回mode(s) replace 用指定值替换系列中的值 sample 返回Series中值的随机样本 sort values 排序 to frame 转换为数据帧 transpose 返回转置 unique 返回numpy.ndarray唯一值 series.py #!/usr/bin/python3 # -*- coding: utf-8 -*- # CreateDate: 2018-3-14 # series.py import pandas as pd import numpy as np scientists = pd.DataFrame( data={'Occupation': ['Chemist', 'Statistician'], 'Born': ['1920-07-25', '1876-06-13'], 'Died': ['1958-04-16', '1937-10-16'], 'Age': [37, 61]}, index=['Rosaline Franklin', 'William Gosset'], columns=['Occupation', 'Born', 'Died', 'Age']) print(scientists) # 从数据帧(DataFrame)获取的行或者列为Series first_row = scientists.loc['William Gosset'] print(type(first_row)) print(first_row) # index和keys是一样的 print(first_row.index) print(first_row.keys()) print(first_row.values) print(first_row.index[0]) print(first_row.keys()[0]) # Pandas.Series和numpy.ndarray很类似 ages = scientists['Age'] print(ages) # 统计,更多参考http://pandas.pydata.org/pandas-docs/stable/basics.html#descriptive-statistics print(ages.mean()) print(ages.min()) print(ages.max()) print(ages.std()) scientists = pd.read_csv('../data/scientists.csv') ages = scientists['Age'] print(ages) print(ages.mean()) print(ages.describe()) print(ages[ages > ages.mean()]) print(ages > ages.mean()) manual_bool_values = [True, True, False, False, True, True, False, False] print(ages[manual_bool_values]) print(ages + ages) print(ages * ages) print(ages + 100) print(ages * 2) print(ages + pd.Series([1, 100])) # print(ages + np.array([1, 100])) 会报错,不同类型相加,大小一定要一样 print(ages + np.array([1, 100, 1, 100, 1, 100, 1, 100])) # 排序: 默认有自动排序 print(ages) rev_ages = ages.sort_index(ascending=False) print(rev_ages) print(ages * 2) print(ages + rev_ages) 执行结果 $ python3 series.py Occupation Born Died Age Rosaline Franklin Chemist 1920-07-25 1958-04-16 37 William Gosset Statistician 1876-06-13 1937-10-16 61 <class 'pandas.core.series.Series'> Occupation Statistician Born 1876-06-13 Died 1937-10-16 Age 61 Name: William Gosset, dtype: object Index(['Occupation', 'Born', 'Died', 'Age'], dtype='object') Index(['Occupation', 'Born', 'Died', 'Age'], dtype='object') ['Statistician' '1876-06-13' '1937-10-16' 61] Occupation Occupation Rosaline Franklin 37 William Gosset 61 Name: Age, dtype: int64 49.0 37 61 16.97056274847714 0 37 1 61 2 90 3 66 4 56 5 45 6 41 7 77 Name: Age, dtype: int64 59.125 count 8.000000 mean 59.125000 std 18.325918 min 37.000000 25% 44.000000 50% 58.500000 75% 68.750000 max 90.000000 Name: Age, dtype: float64 1 61 2 90 3 66 7 77 Name: Age, dtype: int64 0 False 1 True 2 True 3 True 4 False 5 False 6 False 7 True Name: Age, dtype: bool 0 37 1 61 4 56 5 45 Name: Age, dtype: int64 0 74 1 122 2 180 3 132 4 112 5 90 6 82 7 154 Name: Age, dtype: int64 0 1369 1 3721 2 8100 3 4356 4 3136 5 2025 6 1681 7 5929 Name: Age, dtype: int64 0 137 1 161 2 190 3 166 4 156 5 145 6 141 7 177 Name: Age, dtype: int64 0 74 1 122 2 180 3 132 4 112 5 90 6 82 7 154 Name: Age, dtype: int64 0 38.0 1 161.0 2 NaN 3 NaN 4 NaN 5 NaN 6 NaN 7 NaN dtype: float64 0 38 1 161 2 91 3 166 4 57 5 145 6 42 7 177 Name: Age, dtype: int64 0 37 1 61 2 90 3 66 4 56 5 45 6 41 7 77 Name: Age, dtype: int64 7 77 6 41 5 45 4 56 3 66 2 90 1 61 0 37 Name: Age, dtype: int64 0 74 1 122 2 180 3 132 4 112 5 90 6 82 7 154 Name: Age, dtype: int64 0 74 1 122 2 180 3 132 4 112 5 90 6 82 7 154 Name: Age, dtype: int64 数据帧(DataFrame) DataFrame是最常见的Pandas对象,可认为是Python存储类似电子表格的数据的方式。Series多常见功能都包含在DataFrame中。 子集的方法 注意ix现在已经不推荐使用。 DataFrame常用的索引操作有: 方式 描述 df[val] 选择单个列 df [[ column1, column2, ... ]] 选择多个列 df.loc[val] 选择行 loc [[ label1 , label2 ,...]] | 选择多行 |df.loc[:, val] | 基于行index选择列 | df.loc[val1, val2] | 选择行列 |df.iloc[row number] | 基于行数选择行 | iloc [[ row1, row2, ...]] Multiple rows by row number | 基于行数选择多行 |df.iloc[:, where] | 选择列 | df.iloc[where_i, where_j] | 选择行列 |df.at[label_i, label_j] | 选择值 |df.iat[i, j] | 选择值 |reindex method | 通过label选择多行或列 |get_value, set_value | 通过label选择耽搁行或列 df[bool] | 选择行df [[ bool1, bool2, ...]] | 选择行df[ start :stop: step ] | 基于行数选择行 #!/usr/bin/python3 # -*- coding: utf-8 -*- # CreateDate: 2018-3-31 # df.py import pandas as pd import numpy as np scientists = pd.read_csv('../data/scientists.csv') print(scientists[scientists['Age'] > scientists['Age'].mean()]) first_half = scientists[: 4] second_half = scientists[ 4 :] print(first_half) print(second_half) print(first_half + second_half) print(scientists * 2) 执行结果 #!/usr/bin/python3 # -*- coding: utf-8 -*- # df.py import pandas as pd import numpy as np scientists = pd.read_csv('../data/scientists.csv') print(scientists[scientists['Age'] > scientists['Age'].mean()]) first_half = scientists[: 4] second_half = scientists[ 4 :] print(first_half) print(second_half) print(first_half + second_half) print(scientists * 2) 执行结果 $ python3 df.py Name Born Died Age Occupation 1 William Gosset 1876-06-13 1937-10-16 61 Statistician 2 Florence Nightingale 1820-05-12 1910-08-13 90 Nurse 3 Marie Curie 1867-11-07 1934-07-04 66 Chemist 7 Johann Gauss 1777-04-30 1855-02-23 77 Mathematician Name Born Died Age Occupation 0 Rosaline Franklin 1920-07-25 1958-04-16 37 Chemist 1 William Gosset 1876-06-13 1937-10-16 61 Statistician 2 Florence Nightingale 1820-05-12 1910-08-13 90 Nurse 3 Marie Curie 1867-11-07 1934-07-04 66 Chemist Name Born Died Age Occupation 4 Rachel Carson 1907-05-27 1964-04-14 56 Biologist 5 John Snow 1813-03-15 1858-06-16 45 Physician 6 Alan Turing 1912-06-23 1954-06-07 41 Computer Scientist 7 Johann Gauss 1777-04-30 1855-02-23 77 Mathematician Name Born Died Age Occupation 0 NaN NaN NaN NaN NaN 1 NaN NaN NaN NaN NaN 2 NaN NaN NaN NaN NaN 3 NaN NaN NaN NaN NaN 4 NaN NaN NaN NaN NaN 5 NaN NaN NaN NaN NaN 6 NaN NaN NaN NaN NaN 7 NaN NaN NaN NaN NaN Name Born \ 0 Rosaline FranklinRosaline Franklin 1920-07-251920-07-25 1 William GossetWilliam Gosset 1876-06-131876-06-13 2 Florence NightingaleFlorence Nightingale 1820-05-121820-05-12 3 Marie CurieMarie Curie 1867-11-071867-11-07 4 Rachel CarsonRachel Carson 1907-05-271907-05-27 5 John SnowJohn Snow 1813-03-151813-03-15 6 Alan TuringAlan Turing 1912-06-231912-06-23 7 Johann GaussJohann Gauss 1777-04-301777-04-30 Died Age Occupation 0 1958-04-161958-04-16 74 ChemistChemist 1 1937-10-161937-10-16 122 StatisticianStatistician 2 1910-08-131910-08-13 180 NurseNurse 3 1934-07-041934-07-04 132 ChemistChemist 4 1964-04-141964-04-14 112 BiologistBiologist 5 1858-06-161858-06-16 90 PhysicianPhysician 6 1954-06-071954-06-07 82 Computer ScientistComputer Scientist 7 1855-02-231855-02-23 154 MathematicianMathematician 修改列 #!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: xurongzhong#126.com wechat:pythontesting qq:37391319 # qq群:144081101 591302926 567351477 # CreateDate: 2018-06-07 # change.py import pandas as pd import numpy as np import random scientists = pd.read_csv('../data/scientists.csv') print(scientists['Born'].dtype) print(scientists['Died'].dtype) print(scientists.head()) # 转为日期 参考:https://docs.python.org/3.5/library/datetime.html born_datetime = pd.to_datetime(scientists['Born'], format='%Y-%m-%d') died_datetime = pd.to_datetime(scientists['Died'], format='%Y-%m-%d') # 增加列 scientists['born_dt'], scientists['died_dt'] = (born_datetime, died_datetime) print(scientists.shape) print(scientists.head()) random.seed(42) random.shuffle(scientists['Age']) # 此修改会作用于scientists print(scientists.head()) scientists['age_days_dt'] = (scientists['died_dt'] - scientists['born_dt']) print(scientists.head()) 执行结果: $ python3 change.py object object Name Born Died Age Occupation 0 Rosaline Franklin 1920-07-25 1958-04-16 37 Chemist 1 William Gosset 1876-06-13 1937-10-16 61 Statistician 2 Florence Nightingale 1820-05-12 1910-08-13 90 Nurse 3 Marie Curie 1867-11-07 1934-07-04 66 Chemist 4 Rachel Carson 1907-05-27 1964-04-14 56 Biologist (8, 7) Name Born Died Age Occupation born_dt \ 0 Rosaline Franklin 1920-07-25 1958-04-16 37 Chemist 1920-07-25 1 William Gosset 1876-06-13 1937-10-16 61 Statistician 1876-06-13 2 Florence Nightingale 1820-05-12 1910-08-13 90 Nurse 1820-05-12 3 Marie Curie 1867-11-07 1934-07-04 66 Chemist 1867-11-07 4 Rachel Carson 1907-05-27 1964-04-14 56 Biologist 1907-05-27 died_dt 0 1958-04-16 1 1937-10-16 2 1910-08-13 3 1934-07-04 4 1964-04-14 /usr/lib/python3.5/random.py:272: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy x[i], x[j] = x[j], x[i] Name Born Died Age Occupation born_dt \ 0 Rosaline Franklin 1920-07-25 1958-04-16 66 Chemist 1920-07-25 1 William Gosset 1876-06-13 1937-10-16 56 Statistician 1876-06-13 2 Florence Nightingale 1820-05-12 1910-08-13 41 Nurse 1820-05-12 3 Marie Curie 1867-11-07 1934-07-04 77 Chemist 1867-11-07 4 Rachel Carson 1907-05-27 1964-04-14 90 Biologist 1907-05-27 died_dt 0 1958-04-16 1 1937-10-16 2 1910-08-13 3 1934-07-04 4 1964-04-14 Name Born Died Age Occupation born_dt \ 0 Rosaline Franklin 1920-07-25 1958-04-16 66 Chemist 1920-07-25 1 William Gosset 1876-06-13 1937-10-16 56 Statistician 1876-06-13 2 Florence Nightingale 1820-05-12 1910-08-13 41 Nurse 1820-05-12 3 Marie Curie 1867-11-07 1934-07-04 77 Chemist 1867-11-07 4 Rachel Carson 1907-05-27 1964-04-14 90 Biologist 1907-05-27 died_dt age_days_dt 0 1958-04-16 13779 days 1 1937-10-16 22404 days 2 1910-08-13 32964 days 3 1934-07-04 24345 days 4 1964-04-14 20777 days 数据导入导出 out.py #!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: china-testing#126.com wechat:pythontesting qq群:630011153 # CreateDate: 2018-3-31 # out.py import pandas as pd import numpy as np import random scientists = pd.read_csv('../data/scientists.csv') names = scientists['Name'] print(names) names.to_pickle('../output/scientists_names_series.pickle') scientists.to_pickle('../output/scientists_df.pickle') # .p, .pkl, .pickle 是常用的pickle文件扩展名 scientist_names_from_pickle = pd.read_pickle('../output/scientists_df.pickle') print(scientist_names_from_pickle) names.to_csv('../output/scientist_names_series.csv') scientists.to_csv('../output/scientists_df.tsv', sep='\t') # 不输出行号 scientists.to_csv('../output/scientists_df_no_index.csv', index=None) # Series可以转为df再输出成excel文件 names_df = names.to_frame() names_df.to_excel('../output/scientists_names_series_df.xls') names_df.to_excel('../output/scientists_names_series_df.xlsx') scientists.to_excel('../output/scientists_df.xlsx', sheet_name='scientists', index=False) 执行结果: $ python3 out.py 0 Rosaline Franklin 1 William Gosset 2 Florence Nightingale 3 Marie Curie 4 Rachel Carson 5 John Snow 6 Alan Turing 7 Johann Gauss Name: Name, dtype: object Name Born Died Age Occupation 0 Rosaline Franklin 1920-07-25 1958-04-16 37 Chemist 1 William Gosset 1876-06-13 1937-10-16 61 Statistician 2 Florence Nightingale 1820-05-12 1910-08-13 90 Nurse 3 Marie Curie 1867-11-07 1934-07-04 66 Chemist 4 Rachel Carson 1907-05-27 1964-04-14 56 Biologist 5 John Snow 1813-03-15 1858-06-16 45 Physician 6 Alan Turing 1912-06-23 1954-06-07 41 Computer Scientist 7 Johann Gauss 1777-04-30 1855-02-23 77 Mathematician 注意:序列一般是直接输出成excel文件 更多的输入输出方法: 方式 描述 to_clipboard 将数据保存到系统剪贴板进行粘贴 to_dense 将数据转换为常规“密集”DataFrame to_dict 将数据转换为Python字典 to_gbq 将数据转换为Google BigQuery表格 toJidf 将数据保存为分层数据格式(HDF) to_msgpack 将数据保存到可移植的类似JSON的二进制文件中 toJitml 将数据转换为HTML表格 tojson 将数据转换为JSON字符串 toJatex 将数据转换为LTEXtabular环境 to_records 将数据转换为记录数组 to_string 将DataFrame显示为stdout的字符串 to_sparse 将数据转换为SparceDataFrame to_sql 将数据保存到SQL数据库中 to_stata 将数据转换为Stata dta文件 读CSV文件 read_csv.py #!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: china-testing#126.com wechat:pythontesting QQ群:630011153 # CreateDate: 2018-3-9 # read_csv.py import pandas as pd df = pd.read_csv("1.csv", header=None) # 不读取列名 print("df:") print(df) print("df.head():") print(df.head()) # head(self, n=5),默认为5行,类似的有tail print("df.tail():") print(df.tail()) df = pd.read_csv("1.csv") # 默认读取列名 print("df:") print(df) df = pd.read_csv("1.csv", names=['号码','群号']) # 自定义列名 print("df:") print(df) # 自定义列名,去掉第一行 df = pd.read_csv("1.csv", skiprows=[0], names=['号码','群号']) print("df:") print(df) 执行结果: df: 0 1 0 qq qqgroup 1 37391319 144081101 2 37391320 144081102 3 37391321 144081103 4 37391322 144081104 5 37391323 144081105 6 37391324 144081106 7 37391325 144081107 8 37391326 144081108 9 37391327 144081109 10 37391328 144081110 11 37391329 144081111 12 37391330 144081112 13 37391331 144081113 14 37391332 144081114 15 37391333 144081115 df.head(): 0 1 0 qq qqgroup 1 37391319 144081101 2 37391320 144081102 3 37391321 144081103 4 37391322 144081104 df.tail(): 0 1 11 37391329 144081111 12 37391330 144081112 13 37391331 144081113 14 37391332 144081114 15 37391333 144081115 df: qq qqgroup 0 37391319 144081101 1 37391320 144081102 2 37391321 144081103 3 37391322 144081104 4 37391323 144081105 5 37391324 144081106 6 37391325 144081107 7 37391326 144081108 8 37391327 144081109 9 37391328 144081110 10 37391329 144081111 11 37391330 144081112 12 37391331 144081113 13 37391332 144081114 14 37391333 144081115 df: 号码 群号 0 qq qqgroup 1 37391319 144081101 2 37391320 144081102 3 37391321 144081103 4 37391322 144081104 5 37391323 144081105 6 37391324 144081106 7 37391325 144081107 8 37391326 144081108 9 37391327 144081109 10 37391328 144081110 11 37391329 144081111 12 37391330 144081112 13 37391331 144081113 14 37391332 144081114 15 37391333 144081115 df: 号码 群号 0 37391319 144081101 1 37391320 144081102 2 37391321 144081103 3 37391322 144081104 4 37391323 144081105 5 37391324 144081106 6 37391325 144081107 7 37391326 144081108 8 37391327 144081109 9 37391328 144081110 10 37391329 144081111 11 37391330 144081112 12 37391331 144081113 13 37391332 144081114 14 37391333 144081115 写CSV文件 #!/usr/bin/python3 # -*- coding: utf-8 -*- # write_csv.py import pandas as pd data ={'qq': [37391319,37391320], 'group':[1,2]} df = pd.DataFrame(data=data, columns=['qq','group']) df.to_csv('2.csv',index=False) 读写excel和csv类似,不过要改用read_excel来读,excel_summary_demo, 提供了多个excel求和的功能,可以做为excel读写的实例,这里不再赘述。 参考资料 技术支持qq群144081101 591302926 567351477 钉钉免费群21745728 本文最新版本地址 本文涉及的python测试开发库 谢谢点赞! 本文相关海量书籍下载 源码下载 本文英文版书籍下载

优秀的个人博客,低调大师

十年云化之路 中国移动快速向下一代IT架构转型

中国移动一直致力于成为数字化创新的全球领先运营商,于2016年中开始推进实施“大连接”战略,从聚焦管道连接服务向平台级服务和垂直应用领域拓展,打造电信级的端到端信息基础设施体系和内容应用体系。 如果说过去中国移动通信基本完成了“沟通泛在”的要求和部分的“信息泛在”要求的话,那么,现在更高的“信息泛在”、“感官泛在”、“智能泛在”则要求移动通信网络走向敏捷化、开放化和软件化,这就是常说的“通信4.0”,而云计算是推进“大连接”战略和“通信4.0”亟需打造的关键能力之一。 实际上,云计算平台能力对于中国移动提升创新能力、推进网络转型和锻造人才队伍至关重要。云计算资源池是面向未来最重要的信息基础设施之一,是中国移动打造下一代网络和IT能力提升的关键。 砥砺前行 中国移动10年云化之路 中国移动积极发展云计算以提升网络智能化、业务生态化、运营智慧化,在中国移动通信集团公司党组成员、副总裁李正茂看来,“一方面中国移动可以利用云计算的技术、产品和理念,创新自身的IT架构、网络架构、商业模式和运营模式,提升体验和效率;另一方面中国移动可以发挥自身安全可信的品牌影响、高质量的连接与管道优势,通过打造统一云平台,面向企业以云服务的方式提供计算、存储、网络、通讯、IoT、视频等服务,重塑B2B商业模式,扩大市场空间。” 早在2007年,中国移动就启动了“大云”计划,正式开始了云计算、大数据的研究和应用,到现在已整整十年。十年间,“大云”产品已经在推动中国移动IT技术架构变革和业务创新,在支撑各行业企业智慧经营和服务提升方面做出了重要贡献,包括建成了中国移动一级私有云,有着全球最大的OpenStack集群、最大的SDN商用集群。中国移动还用“大云”建设了中国移动公众服务云,已上线3000个物理节点。 中国移动大云4.0 依托大云平台,中国移动打造的以大数据和云计算为核心能力的新一代IT平台正在成为中国移动数字化转型和对外赋能的新动力。如今,中国移动大云更新到4.0,覆盖I/Re/S/M/A五层架构,实现大规模实例、多场景服务、跨行业应用,为各行业提供公有云、私有云、混合云、专有云、行业云总体解决方案,大云4.0主要包含云计算、大数据技术和平台产品,包括Hadoop系统、搜索引擎、Pass平台、大云数据中心操作系统等26项核心产品,实现在大IT技术架构下的全新平台、服务和生态构建能力。 大云推动中国移动IT能力提升和数字化转型 中移软件副总经理孙少陵表示,移动公有云采用一云多池“5+X”两级架构体系。中国移动集团五大资源池构成核心层,省公司资源池作为边缘计算节点构成接入层。2016年,移动云完成南北资源池布局,Openstack集群规模超3000节点;2017年移动云新增湖南资源池节点,扩容北京节点,统一纳管云南等省级资源池节点,提供39项产品和7个支撑系统,已获得多项认证,可提供安全、可信的云服务。 对内方面,通过总部大规模集中新建一级平台,省公司开展多域、异地、异构资源池整合改造并纳管到一级平台,形成“一级平台、两级管理”的统一架构,逐步实现中国移动云计算资源的统一管理、统一运维和集中运营,有效支撑中国移动IT架构转型、业务创新和降本增效。 中国移动实现云计算资源集中化 作为全球第五个、中国首个OpenStack Superuser,“中国移动私有云应用范围超过27个省份、部署规模超过1万节点,拥有最大的OpenStack资源池和SDN商用集群(3000节点)、最大的物理机和虚拟机统一管理集群、首次实现异构SDN统一管理、物理机和虚拟机混合组网。” 孙少陵说。 由于中国移动OpenStack集群庞大,其还联合合作伙伴展开了OpenStack大规模物理机上的可伸缩性、可扩展性、动态扩容性和大规模服务能力的测试,在英特尔等合作伙伴的支持下,中国移动OpenStack性能得到显着提升。 电信云方面,为保障电信网络NFV转型,中国移动提出Novonet2020战略,旨在构建“资源可全局共享调度、容量可弹性伸缩、架构可灵活调整、能力可全面开放”的新一代网络。中国移动基于开源ONAP(OPEN-O+ECOMP)和Tacker研发NFV O+产品;基于Openstack开发云OS操作系统产品,在开源基础上优化实时内核、DPDK支持、RDMA支持等性能。由BC-Linux、KVM、Ceph、OVS等组成虚拟化层;BC-EPC提供资源管理、监控、告警等资源池运维功能,同时提供CI/CD能力构建NFV集成测试环境,支持NFV应用的敏捷开发和持续集成。 构建“三环一体”云计算产业生态 在推进云计算和大数据发展进程中,中国移动注重合作共赢,已初步构建了“三环一体”的云计算产业生态系统:与内环单位合作重点开展预研和核心技术研发、社区合作;中环重点开展产品和解决方案集成领域合作;外环重点开展售后服务类合作。中国移动近日揭牌成立了云计算共创中心,联手华为、浪潮、英特尔等国内外合作伙伴在开源发展、产品研发、解决方案提供、行业应用等方面共同打造云计算生态体系。 在内环开展预研和核心技术研发、开源社区类合作中,英特尔作为中国移动重要的合作伙伴,以顾问形式参与中国移动的各项合作,包括服务器定制化、AI、大数据、5G网络转型等。例如在无线网络虚拟化方面,英特尔支撑中国移动在C-RAN这种高实时性应用场景中,灵活运用英特尔资源分配技术,提高整体性能,在消除多线程调度干扰和缩短系统响应时间等方面获得巨大提升。 此外,Cloud Native架构越来越被运营商关注,英特尔针对其技术挑战和难点,与中国移动和中兴通讯一起进行了初步的研究和测试,并在其中提供了关键的解决方案和优化建议,包括借助DPDK加速容器网络连接、基于 Multus技术加速容器平台层、在 Kubernetes中通过节点功能发现(NFD)提供性能加速等,英特尔通过提供支撑和运行微服务化NFV应用的容器方案,帮助中国移动探索网络转型新路径。 在大云的落地中,以OpenStack开源社区为基础,英特尔针对中国移动大云OpenStack云计算产品进行性能优化。用英特尔中国运营商事业部总经理叶唯琛的话说,“英特尔和中国移动在IT领域是无处不在的合作关系。”在中国移动OpenStack集群、Hadoop集群中,英特尔提供了不限于CPU的端到端的软硬件解决方案。 今年,以英特尔和中国移动苏州研发中心为主体,双方还通过共建技术创新联合实验室,不断提升中国移动IT创新能力。 整体上,截止目前,中国移动已经通过战略合作、研发外协、模块外购、代理集成、服务支持等多种形式、多个领域的合作,与国内外30多家厂商建立合作关系,共建云计算产业生态。中国移动希望通过新型IT力量,不断挖掘数字化商业价值,加速数字化转型。 原文发布时间为: 2017年9月19日 本文作者:陈广成 本文来自云栖社区合作伙伴至顶网,了解相关信息可以关注至顶网。

优秀的个人博客,低调大师

fhs-framework 3.1 低代码快速开发平台更新,我们只想让普通程序员少写代码

更新内容: PostgreSQL 支持(x_postgres分支) pagex 组件集添加一对多插件 审计日志功能 表单填充(自测和测试神器,不用一个一个输入了) 一对多: 篇幅有限,我们举一个最简单的例子,一个人,有多个手机号,使用PAGEX 主业务json 这么写: [ { type: "text", name: "name", label: "姓名" }, { type: "buttons", name: "buttons", buttons: [ { name: "加一行",//点击加一行后添加一行手机号输入 click: function (_v,_model) { _v.$refs.mobiles[0].addRow(); } } ] }, { type: "one2x", name: "mobiles", defaultValue:{ operator,:'chinaMobile',//运营商默认选中移动 }, //当数据发生改变的时候触发 onDataChange:(_newDatas)=>{ this.$refs.userForm.setModelProp('total',_newDatas.length); }, controls: [ { type: 'select', name: 'operator', label: '运营商', rule: [{ required: true, message: '请选择运营商', trigger: 'change' }], dictCode: "operator",//运营商的字典码 }, { type: 'text', name: 'mobile', label: '手机号', rule: [{pattern: /^0?1(3|4|5|7|8)\d{9}$/, message: '请输入正确得手机号', trigger: 'blur'}], } ] ] 审计日志: 我们致力于显示能让用户和运维人员都能看懂的日志,我们使用了swagger属性名来替代字段名,并且对于一些字典/外键做了翻译。 当然还有优化空间,我们会在后期的版本中继续优化。 表单自动填充: 我们很多项目表单有非常多的字段。这些字段有格式校验,重复校验,在造数据的时候非常麻烦,配合表单自动填充功能,可在开发和测试的时候一键填充表单内容,是不是很香。每个人的生命是宝贵的,应该减少无聊的活。 支持: 根据正则来生成符合指定正则的字符串 内置了一些通用规则,包含:用户名,邮箱,身份证号码,url,ip,数字,日期,手机号,姓名,你可以自己在js里使用正则来扩展通用规则。 支持下拉框,checkbox,radio的自动选中(随机选) 支持程序员写死值 支持在生产环境能屏蔽掉 填充表单的按钮 pagex使用表单填充功能的demo: [ { type: "text", name: "userName", label: "姓名", rule: "required", mock:'@name' //使用通用规则name来自动生成姓名 }, { type: "textarea", name: "remark", label: "备注", mock:'我是备注' //写死值 }, ] FHS Framework介绍: fhs 基于大家常用的技术栈,SpringBoot Cloud Mybatis Plus Sa-Token ,Vue ElementUI等等,但是为了能让程序员减少编码(尤其是无任何意义的编码),我们做了非常多的微创新。 1、翻译服务 就一个注解,可以搞定大部分不需要关联过滤和统计的连表查询 // 字典翻译 ref为非必填 @Trans(type = TransType.DICTIONARY,key = "sex",ref = "sexName") private Integer sex; //这个字段可以不写,实现了TransPojo接口后有一个getTransMap方法,sexName可以让前端去transMap取 private String sexName; //SIMPLE 翻译,用于关联其他的表进行翻译 schoolName 为 School 的一个字段 @Trans(type = TransType.SIMPLE,target = School.class,fields = "schoolName") private String schoolId; //远程翻译,调用其他微服务的数据源进行翻译 @Trans(type = TransType.RPC,targetClassName = "com.fhs.test.pojo.School",fields = "schoolName",serviceName = "easyTrans",alias = "middle") private String middleSchoolId; 本组件已经单独开源:https://gitee.com/fhs-opensource/easy_trans 2、每一个业务都可以有一个牛逼的父类 简单的业务,mapper,service,controller中不需要写业务代码,生成个空类即可,父类已经有所有功能了。 3、高级查询API 对于单表查询API,后端继承了父类后,前端都可以通过高级查询API自己拼接过滤条件,不需要写代码。 { "sorter":[{//排序支持ASC和DESC "property":"userId", "direction":"DESC" }], "querys":[{//过滤条件 where sex=男 and (name=张三 or name=李四 ) "property":"name", // po字段名 "operator":"=",//操作符 "value":"张三",//操作值 "relation":"OR",//关联关系AND OR "group":"nameGroup"//相同的group 外层会加括号 }, { "property":"name", "operator":"=", "value":"李四", "relation":"OR", "group":"nameGroup" },{ "property":"sex", //使用了默认的关联关系AND 以及默认操作符 = "value":"男" }] } 后端也设计了安全字段,部分字段前端传了并不会起作用。 3、pagex vue组件集 pagex 组件基于elementUI为基础,集封装了常见的表单组件,程序员可以使用JSON来写组件代码,可以把表单和列表代码量减少60%+。 虽然pagex看起来很强大,实际他们只是几个vue文件而已,只要有vue组件开发经验的人都可以维护扩展它。 以下是一个DEMO,对字典分组进行增删改查,字典分组有名称和编码2个属性。 <template> <pagex-crudForm :namespace="namespace" :title="title" :crudSett="crudSett" :formSett="formSett" :idFieldName="idFieldName" > </pagex-crudForm> </template> <script> export default { name: "Dict", data() { return { namespace:'dictGroup', title:'字典分组', idFieldName:'groupId',//主键 crudSett:{ // 列表配置 api: '/basic/ms/dictGroup/pagerAdvance', //列表接口 sortSett: [{//排序 "direction": "DESC", "property": "updateTime" }], buttons: [//列表上的按钮 { title: '新增', name: 'add', code: "add", type: 'primary', size: 'mini', icon: 'el-icon-plus', // 支持写click 自定义点击事件,新增组件会自带事件 } ], columns: [ {label: '分组名称', name: 'groupName'},//列 分组名称 {//分组编码列,点击之后跳转到字典项列表 label: '分组编码', name: 'groupCode', type: 'formart', formart: "<label style='cursor:pointer'>${groupCode}</label>",//格式化显示效果 click: function (_row) { this.$router.push({path: '/dict/type/data/',query:{groupCode: _row.groupCode}}); } }, { label: '操作',//操作列 name: 'operation', type: 'textBtn', textBtn: [ { title: "编辑", type: "bottom", size: 'mini' }, { title: "详情", type: "success", size: 'mini' }, { title: "删除", type: "danger", size: 'mini', api: '/basic/ms/dictGroup/' } ], } ], filters: [//过滤条件 {label: '分组名称:', name: 'groupName', placeholder: "分组名称", type: 'text', operation: 'like'},//like 是后台过滤规则,模糊匹配 支持> < != between like 等等 {label: '分组编码:', name: 'groupCode', placeholder: "分组编码", type: 'text', operation: 'like'} ], }, formSett:{// 表单 addApi: '/basic/ms/dictGroup/',//新增表单的url,默认的post updateApi: '/basic/ms/dictGroup/',//修改表单的url 默认是post data:{ //这里写默认值,比如groupName:'默认编码' }, controls:[//表单字段 { type: 'text', name: 'groupName', label: '分组名称', rule: 'required', placeholder: '请输入分组名称' }, { type: 'text', name: 'groupCode', label: '分组编码', rule: 'required', placeholder: '请输入分组编码' } ] }, } }, methods: { //自定义方法 } }; </script> 4、表单初始化 本次更新里写了,这里不重复说明。 5、更简单的微服务调用 只需要在服务提供者的service接口上加@CloudMethod 即可完成接口暴露。 哪个微服务用到直接 Autowired service接口即可(把service接口和一些pojo单独放到模块中给其他模块依赖)。详情:https://gitee.com/fhs-opensource/easy_cloud 6、ALL IN ONE 模式开发 微服务模式部署 在本地调试的时候只启动一个java进程debug,在部署测试环境和生产环境的时候使用微服务+网关模式部署。 大家都知道,微服务开发大家链接同一个注册中心的时候有很多让人 头疼的事情。fhs的这个小特性就避免了这些头疼的事情。

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册